苏飞论坛

标题: a potentially dangerous request.form value was detected from the client [打印本页]

作者: 站长苏飞    时间: 2014-6-28 11:42
标题: a potentially dangerous request.form value was detected from the client
添加这个就行了



用户在页面上提交表单到服务器时,服务器会检测到一些潜在的输入风险,例如使用富文本编辑器控件(RichTextBox、FreeTextBox、CuteEditor等)编辑的内容中包含有HTML标记或脚本标记,ASP.NET页面会抛出一个"A potentially dangerous Request.Form value was deceted from the client"的异常。这个是ASP.NET页面为了防范页面注入功能的一种保护机制,要取消这种保护,常规的做法是在.aspx文件的<%@Page %>部分加入ValidateRequest="false"属性。但是从.NET 4.0开始你可能需要多修改一个地方,在网站的web.config文件中加入这行配置:



[XML] 纯文本查看 复制代码
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime requestValidationMode="2.0"/>
</system.web>

同时,你还需要确保页面上用户输入的部分不会存在任何注入攻击的代码,常用的做法是使用Encode处理。

作者: ching126    时间: 2014-9-5 23:36
我只是路过打酱油的。




欢迎光临 苏飞论坛 (http://www.sufeinet.com/) Powered by Discuz! X3.4