I have custom error pages setup on an ASP.NET website.
我在ASP.NET网站上设置了自定义错误页面。
There is one error that is not showing a custom error page, and just showing the usual yellow ASP.NET error page. If custom errors are turned on it shows "Server error in / application" / "Runtime error", but if custom errors are off it shows "validation of viewstate mac failed" error.
有一个错误没有显示自定义错误页面,只显示通常的黄色ASP.NET错误页面。如果启用了自定义错误,则会显示“服务器错误/应用程序”/“运行时错误”,但如果自定义错误已关闭,则会显示“viewstate mac failed验证失败”错误。
The relevant parts of my web.config are:
我的web.config的相关部分是:
<system.web>
<compilation debug="false" targetFramework="4.0" />
<customErrors mode="On" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="/404.aspx" />
<error statusCode="500" redirect="/500.aspx" />
</customErrors>
<system.webServer>
<httpErrors errorMode="DetailedLocalOnly" />
To trap for this error do I have to use a different status code or substatuscode or is there something else?
要捕获此错误,我是否必须使用不同的状态代码或子代码或者还有其他什么?
NB. Server 2008 R2, IIS 7.
NB。 Server 2008 R2,IIS 7。
1 个解决方案
#1
15
After further research I see that this means that IIS is displaying the error rather than ASP.NET.
经过进一步研究后,我发现这意味着IIS正在显示错误而不是ASP.NET。
I changed the system.webServer part of my web.config so IIS can also use the custom error page and that has solved the problem.
我更改了web.config的system.webServer部分,因此IIS也可以使用自定义错误页面并解决了问题。
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="500" subStatusCode="-1" responseMode="ExecuteURL" path="/500.aspx" />
</httpErrors>
#1
15
After further research I see that this means that IIS is displaying the error rather than ASP.NET.
经过进一步研究后,我发现这意味着IIS正在显示错误而不是ASP.NET。
I changed the system.webServer part of my web.config so IIS can also use the custom error page and that has solved the problem.
我更改了web.config的system.webServer部分,因此IIS也可以使用自定义错误页面并解决了问题。
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="500" subStatusCode="-1" responseMode="ExecuteURL" path="/500.aspx" />
</httpErrors>