开发者

using < > in a ASP.NET MVC Form causing problems

开发者 https://www.devze.com 2023-01-04 04:56 出处:网络
I have 开发者_如何学Pythona problem that seems like there should be a simple solution but haven\'t found it yet.

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.

0

精彩评论

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