在用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" 存在安全隱患