加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

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

发布时间:2020-12-16 00:15:56 所属栏目:asp.Net 来源:网络整理
导读:我在web.config中有这个: httpErrors errorMode="Custom" remove statusCode="404" subStatusCode="-1" / remove statusCode="500" subStatusCode="-1" / error statusCode="404" prefixLanguageFilePath="" path="/Error/NotFound.aspx" responseMode="Red
我在web.config中有这个:
<httpErrors errorMode="Custom">
  <remove statusCode="404" subStatusCode="-1" />
  <remove statusCode="500" subStatusCode="-1" />
  <error statusCode="404" 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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读