Professional Programmer Notes

or just call this my soapbox

Archive for April 2009

Handling mscorlib.dll System.Threading.ThreadAbortException issue in an ASP.NET application

leave a comment »

I discovered an unhandled System.Threading.ThreadAbortException was being thrown in my ASP.NET application. I was only able to see this issue when running the application in the Visual Studio debugger. The offending code was a seemingly trivial call to Response.Redirect.

When I called Response.Redirect, the thread handling the current response would be aborted. The thread didn’t like being aborted out of the blue like that. The fix is to pass the second parameter to the Response.Redirect method which tells Response.Redirect whether or not it should end the response. Passing in false will cause the Redirect method to fire, but allow the original response thread to execute the code after the call to Response.Redirect. I use a Return statement to avoid unnecessary processing.

Microsoft explains it here:;en-us;312629


Written by curtismitchell

April 8, 2009 at 9:20 am

Posted in .net

Tagged with