469,586 Members | 2,207 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,586 developers. It's quick & easy.

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

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
4 4662
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
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
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
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.

Similar topics

2 posts views Thread by mahurshi | last post: by
1 post views Thread by Elliot M. Rodriguez | last post: by
2 posts views Thread by Jeff | last post: by
1 post views Thread by R.A.M. | last post: by
2 posts views Thread by =?Utf-8?B?RGFuZGFuIFpoYW5n?= | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.