HttpError 不会显示自定义错误页面 [英] HttpError will not show custom error pages

查看:13
本文介绍了HttpError 不会显示自定义错误页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 web.config 中有这个:

I've got this in the 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 仍然显示内置的错误页面.

But IIS still shows the built in error page.

有什么想法吗?

推荐答案

这就是我使用它的方式,它适用于我,它看起来非常相似,除了 subStatusCode 指令和 ExecuteURL.

This is how I am using it and it works to me, it looks pretty similar except for the subStatusCode directives and the 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>

这篇关于HttpError 不会显示自定义错误页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆