A potentially dangerous Request.Form value was detected from the client

简介:

有些网站程序选择net2.0首页访问正常  后台操作报net版本错误,选择net4.0首页访问报net版本错误,但是后台操作正常

修改网站程序的web.config配置文件

wKioL1ZSngaCfLAoAABH7hLvf2g348.png

圈起来的两行

用户在页面上提交表单到服务器时,服务器会检测到一些潜在的输入风险,例如使用富文本编辑器控件(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文件中加入这行配置:

<system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <httpRuntime requestValidationMode="2.0"/></system.web>

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



本文转自 佛哒 51CTO博客,原文链接:http://blog.51cto.com/fodaa/1715906,如需转载请自行联系原作者

相关文章
|
9月前
|
KVM 虚拟化
成功解决Problem while trying to mount target]\“. HTTP response code is 400
成功解决Problem while trying to mount target]\“. HTTP response code is 400
|
9月前
|
人工智能 Java
Required request body is missing
Required request body is missing
|
9月前
|
前端开发 数据库
Failed to load response dataNo data found for resource with given identifier
Failed to load response dataNo data found for resource with given identifier
1082 0
|
11月前
|
Java Spring
【feign】Could not write request: no suitable HttpMessageConverter found for request type
【feign】Could not write request: no suitable HttpMessageConverter found for request type
325 0
|
Java 应用服务中间件 Linux
SpringBoot - Processing of multipart/form-data request failed. Unexpected EOF read on the socket
SpringBoot - Processing of multipart/form-data request failed. Unexpected EOF read on the socket
1298 0
SpringBoot - Processing of multipart/form-data request failed. Unexpected EOF read on the socket
|
应用服务中间件 API nginx
解决跨域问题 Response to preflight request doesn't pass access control check
解决跨域问题 Response to preflight request doesn't pass access control check
9347 0
|
JSON 数据格式
Required request body is missing:415
Required request body is missing:415
Required request body is missing:415
|
SQL 关系型数据库 MySQL
【解决思路】HTTP Status 500 Type Exception ReportMessage Request processing failed; 【已解决】
经常测试的一个网页,突然报错500。前面也没有发生过,但突然报错,只能先改错了,不然都没法进入页面。为什么会调用到存在bug的语句,而以前没有发生这种情况?这一问题没能想清楚,只能归咎于编译器了。
304 0
【解决思路】HTTP Status 500 Type Exception ReportMessage Request processing failed; 【已解决】
|
应用服务中间件
returned a response status of 405 Method Not Allowed
returned a response status of 405 Method Not Allowed
returned a response status of 405 Method Not Allowed