S
Steve - DND
I just implemented a page that performs a Response.Redirect(url, true). As
such, I wrapped it in a try catch, and explicitly caught a
ThreadAbortException. However, the thread abort exception was still thrown
at every catch block above the try/catches level, as well as at the *same*
level as the try/catch. This does not seem like proper behavior at all. Once
I've caught the exception, why is it still propagating up the stack? I could
maybe understand it going up the stack, but how it it getting into catch
blocks at the same level? Below is some code that illustrates what happened.
function void doStuff(string url) {
try {
try {
Response.Redirect(url, true);
} catch (ThreadAbortException) {
//This is hit
Logger.Log("Aborted");
}
try {
} catch (Exception e) {
//This is hit.
Logger.Log(e, "Aborted same level");
}
} catch (Exception e) {
//This is hit.
Logger.Log(e, "Aborted level above");
}
}
All of those Log statements are hit unless for each one I put a "catch
(ThreadAbortException)" in there. What is going on here, and why?
Thanks,
Steve
such, I wrapped it in a try catch, and explicitly caught a
ThreadAbortException. However, the thread abort exception was still thrown
at every catch block above the try/catches level, as well as at the *same*
level as the try/catch. This does not seem like proper behavior at all. Once
I've caught the exception, why is it still propagating up the stack? I could
maybe understand it going up the stack, but how it it getting into catch
blocks at the same level? Below is some code that illustrates what happened.
function void doStuff(string url) {
try {
try {
Response.Redirect(url, true);
} catch (ThreadAbortException) {
//This is hit
Logger.Log("Aborted");
}
try {
} catch (Exception e) {
//This is hit.
Logger.Log(e, "Aborted same level");
}
} catch (Exception e) {
//This is hit.
Logger.Log(e, "Aborted level above");
}
}
All of those Log statements are hit unless for each one I put a "catch
(ThreadAbortException)" in there. What is going on here, and why?
Thanks,
Steve