using < > in a ASP.NET MVC Form causing problems
I have 开发者_如何学Pythona problem that seems like there should be a simple solution but haven't found it yet.
I have a pretty simple form that calls an action and passes it a FormCollection via HTTP Post.
The form works perfectly until I introduce <
or >
into the field. Then I end up on a blank page having skipped the Action altogether.
Need more information? Have any suggestions? Please help!
Decorate your action with [ValidateInput(false)]
attribute
You will want to encode these. AntiXSS has a library that encodes a variety of ways (because encoding for HTML, URL, XML, attributes, etc are all slightly different)
If you want to turn off security (not a good idea if you care about security), Hanselman has an article on that, too.
精彩评论