I am trying to use SkipRequestValidation attribute on property of my model But 开发者_StackOverflow中文版that attribute is not exist in any assembly of default ASP.NET MVC 3 project.
Where is SkipRequestValidation attribute ?
No such attribute exists out of the box in ASP.NET MVC 3 RTM. You have the [AllowHtml]
attribute that you could apply on your model properties.
If you want to allow users to post html to your application, you must use ValidateInput
attribute on methods that control the html contained requests; for example:
public class Home: Controller{
[HttpPost]
[ValidateInput(false)]
public ActionResult Create(MyModel model){
// do something
}
}
here one or more properties of model, contains html value; Regards
Thanks, this post was so helpful, and after replacing SkipRequestValidation with [AllowHtml] issue is fixed and working fine.
精彩评论