ASP.NET / Web.config: customErrors redirect only on a 404

眉间皱痕 提交于 2019-12-03 12:23:01

In the following web.config entries, a not found (404) condition will send a user to PageNotFound.aspx

Use mode="Off" and everyone (local and remote users) will see error details.

<customErrors mode="Off">
     <error statusCode="404" redirect="~/errorPages/PageNotFound.aspx" />
</customErrors>

Use mode="RemoteOnly" and local users will see detailed error pages with a stack trace and compilation details. Remote users with be presented with the GeneralError.aspx page

<customErrors mode="RemoteOnly" defaultRedirect="~/errorPages/GeneralError.aspx">
     <error statusCode="404" redirect="~/errorPages/PageNotFound.aspx" />
</customErrors>

Ray Van Halens Answer is correct, but this was not the actual problem.

The reason for not showing stacktrace is a bug in mono itself. There is no other way then write an own error page where the stacktrace is dispayed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!