如何捕获这个异常,显示友好提示A potentially dangerous Request.Path value was detected from the
这个是.net4.0用来防止畸形URL攻击的功能,当使用恶意畸形URL访问时候,就会出现程序错误提示,我想保留这个功能,但是想显示出自己设计的友好提示页面,而不是系统错误页面,要在哪个位置捕获这个异常呢?环境是4.0 webform,谢谢!!
Exception information:
Exception type: HttpException
Exception message: A potentially dangerous Request.Path value was detected from the client (&).
at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.ValidateRequestExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
------解决方案--------------------web.config
system.web节点:
<customErrors mode="On" defaultRedirect="~/404.aspx">
<error statusCode="404" redirect="~/404.aspx"/>
<error statusCode="403" redirect="~/404.aspx"/>
</customErrors>
------解决方案--------------------接分,也可以在httpmodule做处理
------解决方案--------------------学习