“潜在危险请求.RawUrl”的可能原因是什么?

时间:2009-10-27 10:07:21

标签: asp.net exception webforms rawurl

在asp.net Web表单应用程序中,我们有时会收到“有潜在危险的Request.RawUrl”的错误消息,但我找不到它的来源。

此例外可能的原因是什么?


我们案例的一些细节:

Event message: A validation error has occurred

Exception type: System.Web.HttpRequestValidationException

Exception message: A potentially dangerous Request.RawUrl value was 
detected from the client (="..._Combin%20%20%20%20%20%2...").

Request URL: https://somesite/somepage.aspx
?_TSM_HiddenField_=ctl00_sm1_HiddenField
&_TSM_Combin%20</div>%20%20%20%20%20%20%20%20<div%20id=

Stack trace:    at System.Web.HttpRequest.ValidateString(String s, String valueName, String collectionName)
   at System.Web.HttpRequest.get_RawUrl()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.somepage_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

我在生成的页面的html中识别出TSM_HiddenField的部分:

<script src="/somepage.aspx?_TSM_HiddenField_=ctl00_sm1_HiddenField&_TSM_CombinedScripts_=
%3b%3bAjaxControlToolkit%2c+Version%3d3.5.11119.20050%2c+Culture%3dneutral%2c
+PublicKeyToken%3d28f01b0e84b6d53e%3ada-DK%3a8e147239-dd05-47b0-8fb3-f743a139f982
%3ae2e86ef9%3a1df13a87%3a8ccd9c1b%3ac4c00916%3a9ea3f0e2%3a9e8e87e9
%3a4c9865be%3aba594826%3ac76f1358" type="text/javascript"></script> 

...所以在这种情况下似乎与AjaxControlToolkit有关,但是这个异常怎么会发生呢?

(当用户登录时会发生这种情况,因此我怀疑是否涉及某些爬虫或黑客攻击......)

2 个答案:

答案 0 :(得分:1)

看起来您在提交的表单字段中有HTML标记,可能就是这个:

&_TSM_Combin%20</div>%20%20%20%20%20%20%20%20<div%20id=

<div>是罪魁祸首。

答案 1 :(得分:0)

认为它与ASP.NET请求验证有关:http://www.asp.net/learn/whitepapers/request-validation/

如果e,则抛出异常。 G。 HTML标记随请求一起发送。