System.Web.HttpRequestValidationException: 从客户端(&md.)中检测到有潜在危险的 Request.Form 值

来源:互联网 发布:js 定义二维数组 编辑:程序博客网 时间:2024/04/25 00:21
在用ASP.NET开发网站时,用ajax传CKEDITOR传过来的数据,遇到《System.Web.HttpRequestValidationException: 从客户端(&md.)中检测到有潜在危险的 Request.Form 值
》错误提示,找了好半天终于解决了。如下:   在 System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection)   在 System.Web.HttpRequest.ValidateHttpValueCollection(HttpValueCollection collection, RequestValidationSource requestCollection)   在 System.Web.HttpRequest.get_Form()   在 System.Web.Services.Protocols.HtmlFormParameterReader.Read(HttpRequest request)   在 System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()   在 System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

WebService报错:
通过WebService页面上的参数文本框传值(xml字符串)request validation的时候为了防止危险的客户端输入就会抛HttpRequestValidationException。

解决方法:

<system.web>
  <pages validateRequest="false"/>
  <httpRuntime requestValidationMode="2.0"/>
</system.web>

 

validateRequest="false" 存在安全隐患

警告:为了安全请不要随意将ASP.Net的validateRequest="false" . 

阅读全文
0 0
原创粉丝点击