HTTPError这样将不显示自定义错误页 [英] HttpError will not show custom error pages

查看:198
本文介绍了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.

任何想法?

推荐答案

这是我如何使用它和它的作品对我来说,它看起来除了子状态code指令和ExecuteURL类似pretty。

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天全站免登陆