【发布时间】:2010-10-20 06:50:14
【问题描述】:
由于某种原因,当我收到 ASP.NET 运行时错误时,它没有加载我的自定义错误页面
<customErrors mode="On" defaultRedirect="app_offline.htm" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="app_offline.htm"/>
<error statusCode="500" redirect="app_offline.htm"/>
</customErrors>
这在我的 web.config 中。
我仍然得到这个,它没有加载我的错误 .htm 页面:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
【问题讨论】:
-
我将更新线程...我收到有关自定义错误的典型错误。这是托管在 discountasp.net 上
-
为什么要使用 app_offline.htm 作为自定义错误?如果存在此文件首先会阻止您的 Web 应用程序。第二次打开错误,看看真正的错误。 (或查看您的日志)
-
这就是交易。我不想修复错误。我想重定向到我的自定义错误页面并收工并上床睡觉。这应该重定向我!
-
你有
redirectMode="ResponseRewrite"是不是一个特殊的原因?当您遇到问题时,您应该首先尝试默认设置(redirectMode="ResponseRedirect",或完全删除该设置)。然后你可能会看到它实际上试图重定向到什么.. -
在发布此主题之前,我已经尝试将其删除;与redirectMode无关
标签: asp.net