Sunil
Sunil

Reputation: 21406

ELMAH logging when customErrors mode= 'Off' and error is cleared in Application_Error event

This question relates to using ELMAH in an ASP.Net application. I have the following in my web.config.

<customErrors mode="Off" ">
</customErrors>

Also, whenever an unhandled error occurs, I clear it in Application_Error event as in code below.

protected void Application_Error(object sender, EventArgs e)
{
  Server.ClearError();
  Response.Redirect("~/errorpages/error.aspx");
} 

My question : Will ELMAH log and email the error in this situation? I have the standard configuration for ELMAH in the web.config file.

Upvotes: 0

Views: 467

Answers (1)

Sunil
Sunil

Reputation: 21406

It appears that if the Application_Error event is reached, then ELMAH will log and email the error, even though you clear the error by calling Server.Clear method. But if, your code does not reach Application_Error event, then ELMAH will NOT log and email the error.

Upvotes: 1

Related Questions