ASP.NET CustomError Handling in MasterPage Error Page
I redirect Errors to Error.aspx
<system.web>
<customErrors defaultRedirect="error.aspx" mode="On">
开发者_Python百科 <error redirect="error.aspx" statusCode="500" />
</system.web>
and the problem is that there is also second error in ErrorMasterPage of Error.aspx
<script Language="C#" MasterPageFile="~/ErrorMaster.Master" runat="Server">
and CustomError can not handle the second error while its like a loop ( it will redirect to error.aspx and Masterpage of Error.aspx has Error.
here is problem:
Example:
Login.aspx(has Error) -> Error.aspx -> ErrorMasterPage.Master (has Error) -> Show Yellow Page Thanks
If you're doing automatic redirection using web.config I'd say you should have an error page so simple that almost no server error is possible. If you're accessing the database on that page, you would enter on a loop if the error is related with that.
Another option would be redirecting to the error page using the error handler on global.asax. This would involve C# logic. There, you could detect if the error was generated on error.aspx and on that case, you could redirect to fatalerror.aspx (a white page just showing a message for instance).
精彩评论