views:

561

answers:

2

See http://support.microsoft.com/kb/312629/EN-US/

I am using reponse.direct in my app as well and I am not getting the exception. The workaround that the knowledge base article suggests (Server.Execute) does not work for me. I am getting lots of javascript exceptions from the Ajax Toolkit on the target page if I use Server.Execute, and I did not dig into the cause.

My question - what arguments do you see against just swallowing the exception as a 'known limitation' and moving on?

My reason for using Server.Transfer in this one very specific case is that I want to mask the (real) target url of the page that is actually executing. It works pretty well, except for this exception (that the user never sees).

+2  A: 

Make sure you are not calling Server.Transfer() within an exception handler (try..catch/finally).

Edit:

Server.Transfer always raises ThreadAbortException upon completion. If you wrap it in an exception handler you should trap for explicit exception types instead of just 'Exception'.

See the help for Server.Transfer on MSDN. Here is info about ThreadAbortException

Adam Markowitz
Why not? If I don't catch it in the originating page, the exception survives the call.
cdonner
See updated answer.
Adam Markowitz
A: 

Thanks a lot.