By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,758 Members | 1,225 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,758 IT Pros & Developers. It's quick & easy.

Exception "Thread was being aborted." with Server.Transfer()

P: n/a
Hi,
I'm doing a server.transfer from a click event of a button,
but an exception is raised with "Thread was being aborted"

Anyone know why?

Thanks Tor
Aug 24 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

Totto wrote:
Hi,
I'm doing a server.transfer from a click event of a button,
but an exception is raised with "Thread was being aborted"

Anyone know why?

Thanks Tor
This exception is thrown by the system when a redirection occurs. There
is nothing you can do against it. You must catch it (using try/catch),
but note that the exception is propagated even if you catch it in the
lower layers of your system.

"Transfer calls End, which throws a ThreadAbortException exception upon
completion."

http://msdn2.microsoft.com/en-us/library/y4k58xk7.aspx

"ThreadAbortException is a special exception that can be caught, but it
will automatically be raised again at the end of the catch block."

http://msdn2.microsoft.com/en-us/lib...exception.aspx

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 24 '06 #2

P: n/a
Totto,

This happens because it calls 'Response.End' internally.

check out http://support.microsoft.com/default...b;en-us;312629

Regards,
Augustin
http://augustinprasanna.blogspot.com

"Totto" wrote:
Hi,
I'm doing a server.transfer from a click event of a button,
but an exception is raised with "Thread was being aborted"

Anyone know why?

Thanks Tor
Aug 24 '06 #3

P: n/a
I'm doing a server.transfer from a click event of a button,
but an exception is raised with "Thread was being aborted"
When you do a Server.Transfer, you are saying to ASP.Net, "end the
processing of the current page and transfer control to the new page, and
don't come back to the current page when you are finished!"

To do that ASP.Net causes an exception on the current thread, that will
end the processing of the current page. You can't stop this exception
and you don't need to handle it.

Where are you seeing the exception?

Kevin

Totto wrote:
Hi,
I'm doing a server.transfer from a click event of a button,
but an exception is raised with "Thread was being aborted"

Anyone know why?

Thanks Tor

Aug 24 '06 #4

P: n/a
http://support.microsoft.com/kb/312629/EN-US

....recommends using Server.Execute, instead of Server.Transfer,
to work around that problem.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:u4****************@TK2MSFTNGP05.phx.gbl...
Hi,

Totto wrote:
>Hi,
I'm doing a server.transfer from a click event of a button,
but an exception is raised with "Thread was being aborted"

Anyone know why?

Thanks Tor

This exception is thrown by the system when a redirection occurs. There is nothing you can do
against it. You must catch it (using try/catch), but note that the exception is propagated even if
you catch it in the lower layers of your system.

"Transfer calls End, which throws a ThreadAbortException exception upon completion."

http://msdn2.microsoft.com/en-us/library/y4k58xk7.aspx

"ThreadAbortException is a special exception that can be caught, but it will automatically be
raised again at the end of the catch block."

http://msdn2.microsoft.com/en-us/lib...exception.aspx

HTH,
Laurent

Aug 24 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.