asp.net mvc编码在表单上 [英] asp.net mvc encode on form post
本文介绍了asp.net mvc编码在表单上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从客户端检测到潜在的危险Request.Form值。
我可以如何在文本上对textarea进行编码?我不想取消验证。
有没有办法使用html.encode帮助器提交?
谢谢。
解决方案
你可以装饰处理使用 ValidateInputAttribute 表单发布:
[ValidateInput(false)]
[HttpPost]
public ActionResult SomeActionToHandleFormSubmission()
{
...
}
I'm using a rich text editor in my asp.net mvc form (nicedit with a textarea) and when I submit the form on post, because it is not html encoded I get the following message: "A potentially dangerous Request.Form value was detected from the client" . How can I html encode the textarea on post ? I don't want to cancel the validation. Is there a way to use the html.encode helper on submit?
Thank you.
解决方案
You could decorate the action handling the form post with the ValidateInputAttribute:
[ValidateInput(false)]
[HttpPost]
public ActionResult SomeActionToHandleFormSubmission()
{
...
}
这篇关于asp.net mvc编码在表单上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文