8104

ASP.NET CustomError Handling in MasterPage Error Page

Question:

I redirect Errors to Error.aspx

<system.web> <customErrors defaultRedirect="error.aspx" mode="On"> <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

Answer1:

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).

Recommend

  • Dynamic inflating gives me a nullexception
  • Azure Data Factory On-Premises Copy Error
  • How to put text from file into array
  • Why isn't this code returning these lists? Does this have to do with using 'return' r
  • MVC Child Master page with Razor
  • Placing images programatically on page ASP.net Web application c#
  • One web application project's aspx file is not working into another web application project
  • Optimizing percolator queries in Elasticsearch
  • theano gives “…Waiting for existing lock by unknown process…”
  • object Model types in MVC2 using strongly typed view pages problem
  • Templates or similar for JavaScript programs in the browser
  • How to use compare validator to compare the data between two dropdownlists values?
  • How to change display text in item template based on eval in gridview?
  • ASP.NET RegularExpressionValidator, validate on a non-match?
  • Enumerating Controls on a Form
  • Mixing WebForms and MVC: What should I do with the MasterPage?
  • Scanner nextInt() and hasNextInt() problems
  • Shouldn't else be indented in the below code
  • What causes the runtime difference in this trivial fortran code?
  • In loopback documentation what does variable 'cb' stands for?
  • How to get links to open in the native browser in iOS Meteor apps?
  • How to pass a value from ASP.NET MVC controller to ASP.NET webforms control inside MVC View?
  • NUnit 3.0 TestCase const custom object arguments
  • calculate gradient output for Theta update rule
  • Conversion from string “a” to type 'Boolean' is not valid
  • What does 'Language neutral' mean with regard to MAKELANGID?
  • Marklogic : Query response time is very high
  • Android activity accessing service's static reference before the service is ready
  • Mysterious problem with floating point in LISP - time axis generation
  • Custom validator control occupying space even though display set to dynamic
  • How to know when stdin is empty if it contains EOF?
  • Switching to Release Build causes runtime error in Web Reference
  • Ajax Loaded meta Tags
  • DomPDF {PAGE_NUM} not on first page
  • Javascript simulate pressing enter in input box
  • Importing jscolor library in angular 2
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • How do I rollback to a specific git commit
  • A cron job substitute?
  • Reading document lines to the user (python)