开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜