Application_OnError loop with custom object

G

Guest

I have written a custom exception handler to process exceptions (send email,
write to db).

My code looks like such in the Global.asax Application_OnError event


Exception ex = Server.GetLastError().GetBaseException();
Server.ClearError( );
AppException err = new AppException();
err.ProcessException(ex,
System.Configuration.ConfigurationSettings.AppSettings["dbconnectionstring"]);
int errID = err.EventID;

Response.Redirect("~/custom_err_page.aspx?evtID=" + errID);

When there is like a syntax issue in the page it will just loop for infinity
sending me tons of emails. A good example is a user control I have for the
application header. If I remove a semicolon it will send emails until my
inbox explodes. If it is a access denied on a stored procedure it sends one
email.

Why is it that the Application_OnError method just loops when it encounters
an error such as page level error?

Anyone have any suggestions. Web.Config is not an option for I have to be
able to get the error details from Server.GetLastError();

Thanks
 
W

William F. Robertson, Jr.

On your custom_err_page.aspx override the OnError method and just swallow
the method. I have experience infinite looping with my error handling. So
my error pages, just swallow all errors, and do not allow them to propagate
to the global exception handler.

HTH,

bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top