Freshblood
Freshblood

Reputation: 6441

Where is SkipRequestValidation Attribute in Asp.net MVC

I am trying to use SkipRequestValidation attribute on property of my model But that attribute is not exist in any assembly of default ASP.NET MVC 3 project.

Where is SkipRequestValidation attribute ?

Upvotes: 0

Views: 927

Answers (3)

Yogendra Bhardwaj
Yogendra Bhardwaj

Reputation: 95

Thanks, this post was so helpful, and after replacing SkipRequestValidation with [AllowHtml] issue is fixed and working fine.

Upvotes: 0

amiry jd
amiry jd

Reputation: 27593

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

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1039308

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.

Upvotes: 4

Related Questions