我对新的ASP.NET MVC应用程序的自定义错误页面管理有一个非常有趣的问题.
这个问题是这样的:
- 如果我在URL的末尾用一个"坏"参数调用一个URL(无关紧要)..../c<,那么应用程序就会按照Web中的说明显示正确的服务器错误页面.配置;
- 如果我将URL更改为更讨厌的URL,比如.../<c(看起来更像HTML标签,浏览器中没有显示更多的服务器错误页面,而不是那个,我得到一个带有消息的简单YSOD喜欢An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.
根据ELMAH的说法,两个请求都以400状态代码结束,消息为:
- 第一个:System.Web.HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (<).
at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)
- 第二个:System.Web.HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (<).
at System.Web.HttpRequest.ValidateInputIfRequiredByConfig()
at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)
因此,两个错误都是相同的,状态代码是相同的,但是对于其中一个错误,自定义错误页面没有显示.我也在调试模式下去了global.asax并检查了Server.GetLastError() …