ASP.NET / Web.config: customErrors redirect only on a 404
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>