您的位置:首页 > 产品设计 > UI/UE

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

2017-04-25 14:32 405 查看

错误解决:A potentially dangerous Request.Form value was detected from the client

在网站后台插入数据,返回下面的错误:系统检测到有潜在危险的 Request.Form 值。

A potentially dangerous Request.Form value was detected from the client (txtTest="<b>"). 

这个是因为requestValidationMode是asp.net提供的,用于防止cross-site scripting (XSS)攻击!默认就是开启的!

.net 4之前,它只在aspx文件及类文件被调用的时候,才会起作用!

.net 4之后,它会对所有的http请求起作用,即使用了ValidateRequest=False

要解决验证错误,只能继续使用.net 2.0的请求验证功能:

即在web.config文件中的<system.web>标签中加入下面的代码。

<httpRuntime requestValidationMode="2.0"/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  asp.net
相关文章推荐