asp.net – HttpError不会显示自定义错误页面

前端之家收集整理的这篇文章主要介绍了asp.net – HttpError不会显示自定义错误页面前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在web.config中有这个:
<httpErrors errorMode="Custom">
  <remove statusCode="@R_301_448@" subStatusCode="-1" />
  <remove statusCode="500" subStatusCode="-1" />
  <error statusCode="@R_301_448@" prefixLanguageFilePath="" path="/Error/NotFound.aspx" responseMode="Redirect" />
  <error statusCode="500" prefixLanguageFilePath="" path="/Error/ServerError.aspx" responseMode="Redirect" />
</httpErrors>

但IIS仍显示内置错误页面.

有任何想法吗?

解决方法

这就是我使用它的方式,它对我有用,除了subStatusCode指令和ExecuteURL外,它看起来非常相似.
<httpErrors>
     <!--Remove inherited 500 error page setting -->
     <remove statusCode='500' subStatusCode='-1'/> 
     <!--Override the inherited 500 error page setting with the 'My500.html' as its path-->
     <error statusCode='500' subStatusCode='-1' prefixLanguageFilePath='' path='/My500.html' responseMode='ExecuteURL'/> 
</httpErrors>
原文链接:https://www.f2er.com/aspnet/251838.html

猜你在找的asp.Net相关文章