特殊字符会导致“潜在危险的Request.Form值". [英] Special character causes "A potentially dangerous Request.Form value"
问题描述
我正在为特定需要构建脚注编辑器,并且我需要一个下拉列表,其中显示了诸如匕首(†)之类的特殊字符.不确定是否重要,但是下拉列表采用ajax模态弹出形式.每当我尝试显示弹出表单时,都会出现错误"从客户端检测到潜在危险的Request.Form值(ctl00 $ MainContent $ ucFootNoteList $ DropDownList1 ="*,†")."
I'm building a footnote editor for a specific need and I need a drop list that shows special characters such as a dagger (†). Not sure if it matters, but the drop list is in a ajax modal popup form. Whenever I try to display the popup form, I get the error "A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$ucFootNoteList$DropDownList1="*, †")."
我尝试添加< httpRuntime requestValidationMode ="2.0"/>到Web.config文件.
I tried adding <httpRuntime requestValidationMode="2.0" /> to the Web.config file.
在这种情况下如何显示特殊字符而不会出现此错误?
How do I show a special character in this scenario without this error coming up?
推荐答案
您可以在相应WebForm的Page头上设置 validateRequest
属性,以禁用请求验证并允许发布HTML字符:>
You could set the validateRequest
property on the Page header of the corresponding WebForm to disable request validation and allow posting HTML characters:
<%@ Page validateRequest="false" %>
也可以对web.config中的所有WebForm全局执行此操作:
This could also be done globally for all WebForms in the web.config:
<pages validateRequest="false" />
在MSDN上的 文章
您可以在其中阅读有关ASP.NET中的请求验证的更多信息.
Here's an article
on MSDN where you could read more about request validation in ASP.NET.
这篇关于特殊字符会导致“潜在危险的Request.Form值".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!