| ylbtech-Error-WebForm:從客戶端(ctl00$ContentPlaceHolder1$result="<?xml version="1.0" ...")中檢測到有潛在危險的 Request.Form 值。 |
“/”應用程序中的服務器錯誤。
從客戶端(ctl00$ContentPlaceHolder1$result="<?xml version="1.0" ...")中檢測到有潛在危險的 Request.Form 值。
說明: ASP.NET 在請求中檢測到包含潛在危險的數據,因為它可能包括 HTML 標記或腳本。該數據可能表示存在危及應用程序安全的嘗試,如跨站點腳本攻擊。如果此類型的輸入適用於您的應用程序,則可包括明確允許的網頁中的代碼。有關詳細信息,請參閱 http://go.microsoft.com/fwlink/?LinkID=212874。
異常詳細信息: System.Web.HttpRequestValidationException: 從客戶端(ctl00$ContentPlaceHolder1$result="<?xml version="1.0" ...")中檢測到有潛在危險的 Request.Form 值。
源錯誤:
只有在調試模式下進行編譯時,生成此未經處理的異常的源代碼才會顯示出來。若要啟用此功能,請執行以下步驟之一,然后請求 URL:
1. 在產生錯誤的文件的頂部添加一條“Debug=true”指令。例如:
<%@ Page Language="C#" Debug="true" %>
或:
2. 將以下的節添加到應用程序的配置文件中:
<configuration> <system.web> <compilation debug="true"/> </system.web> </configuration>
請注意,第二個步驟將使給定應用程序中的所有文件在調試模式下進行編譯;第一個步驟僅使該特定文件在調試模式下進行編譯。
重要事項: 以調試模式運行應用程序一定會產生內存/性能系統開銷。在部署到生產方案之前,應確保應用程序調試已禁用。 |
堆棧跟蹤:
[HttpRequestValidationException (0x80004005): 從客戶端(ctl00$ContentPlaceHolder1$result="<?xml version="1.0" ...")中檢測到有潛在危險的 Request.Form 值。]
System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection) +9896308
System.Web.<>c__DisplayClass280_0.<ValidateHttpValueCollection>b__0(String key, String value) +22
System.Web.HttpValueCollection.EnsureKeyValidated(String key) +9894305
System.Web.HttpValueCollection.Get(String name) +17
System.Web.UI.WebControls.TextBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +152
System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +15
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +457
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6569
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +245
System.Web.UI.Page.ProcessRequest() +72
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +22
System.Web.UI.Page.ProcessRequest(HttpContext context) +58
ASP.default_aspx.ProcessRequest(HttpContext context) +48
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +188
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
|
版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.7.2053.0
解決方案一:
在當前頁面<%@ Page validateRequest="false" %>
解決方案二:
修改web.config文件:
<configuration>
<system.web>
<pages validateRequest="false" />
</system.web>
</configuration>
因為validateRequest默認值為true。只要設為false即可。
但是如果新建的項目是用VS2010的。所用的是framework4.0那則需要再在web.config中添加如下配置
<httpRuntime requestValidationMode="2.0" />