System.Threading.ThreadAbortException and Response.Redirect

  • Thread starter Thread starter Henrik Stidsen
  • Start date Start date
H

Henrik Stidsen

I have implemented a log-system for exceptions in an ASP.NET
application using the Application_Error event in Global.asax.
ThreadAbortExceptions gets thrown everytime Response.Redirect is being
used with the second parameter set to true which, according to
Microsoft, is by design...

How do I get around this ? I would hate to have the log filled with
this exception on high-traffic sites. Setting the second parameter to
false is not an option.

I have tried with a try-catch block around the Response.Redirect call,
didn´t help, the exception still gets "recorded".
 
A couple options...

a - Don't set the 2nd parameter to true

b - Before logging the exception, check it's type and don't log
ThreadAbortExceptions

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


I have implemented a log-system for exceptions in an ASP.NET
application using the Application_Error event in Global.asax.
ThreadAbortExceptions gets thrown everytime Response.Redirect is being
used with the second parameter set to true which, according to
Microsoft, is by design...

How do I get around this ? I would hate to have the log filled with
this exception on high-traffic sites. Setting the second parameter to
false is not an option.

I have tried with a try-catch block around the Response.Redirect call,
didn´t help, the exception still gets "recorded".
 
Karl Seguin [MVP] skrev:
A couple options...
a - Don't set the 2nd parameter to true

It would certainly be the easy way - but sometimes the world is not
that easy :(
b - Before logging the exception, check it's type and don't log
ThreadAbortExceptions

Wouldn't I risk to throw out exceptions that I want to log or is
Response.Redirect the only (built-in) function that throws this
Exception ?
 
No, it isn't the only function, so yes, you'd risk throwing away meaningful
information.

Karl
 
This will give more clarity: http://support.microsoft.com/kb/312629/EN-US/

I have implemented a log-system for exceptions in an ASP.NET
application using the Application_Error event in Global.asax.
ThreadAbortExceptions gets thrown everytime Response.Redirect is being
used with the second parameter set to true which, according to
Microsoft, is by design...

How do I get around this ? I would hate to have the log filled with
this exception on high-traffic sites. Setting the second parameter to
false is not an option.

I have tried with a try-catch block around the Response.Redirect call,
didn´t help, the exception still gets "recorded".
 
Back
Top