ASP.NET MVC3: Alternatives to using ValidateInput
We are working on an ASP.NET MVC3 project that utilizes lots of html forms.
Because of ValidateInput=true, < and > characters are forbidden through the site (except html enabled fields (AllowHtml)).
But instead of having server throw "A potentially dangerous Request.Form value was detected from the client" error, we want to catch the error and return an error in modelstate, highlighting the field and saying "You can not use < and > characters".
Is there an easy way to do this or do we have to turn validateinput to false and manually (or by a custom filter) check and imple开发者_StackOverflow社区ment this for each post function?
精彩评论