Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ThreadAbortException

77 views
Skip to first unread message

Tom

unread,
Sep 8, 2003, 9:48:49 AM9/8/03
to
I have read an article on Google that talks about this
error when trying to do a Response.Redirect in .NET.

The artice says if you use the overload the method and
send in a "false" as a second parameter that the error is
suppressed and you are redirected.

ie.
Response.Redirect(Application
["ServerNameReadOnly"].ToString(),false);

But I have found this to be false.

I am still getting a "ThreadAbortException" error thrown
when I try to redirect using the code above.


Can anyone advise?

Thanks

Tom

Yan-Hong Huang[MSFT]

unread,
Sep 8, 2003, 10:36:24 PM9/8/03
to
Hello Tom,

Thanks for posting in the group.

In ASP.NET 1.0 and 1.1, If you use the Response.End, Response.Redirect, or
Server.Transfer method, a ThreadAbortException exception occurs. You can
use a try-catch statement to catch this exception. .

The cause of this issue is that the Response.End method ends the page
execution and shifts the execution to the Application_EndRequest event in
the application's event pipeline. The line of code that follows
Response.End is not executed.

This problem occurs in the Response.Redirect and Server.Transfer methods
because both methods call Response.End internally.

The way you used is correct to resolve this issue. For details, please
refer to MSDN article:
"PRB: ThreadAbortException Occurs If You Use Response.End,
Response.Redirect, or Server.Transfer"
http://support.microsoft.com/default.aspx?scid=kb;en-us;q312629

However, if the exception is not caused by this issue, then it won't
resolve it. So please make sure that ThreadAbortException is caused by
Response.Redirect. I think you could test with a simple aspx page first.

Does this answer your question?

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Tom" <dar...@fhlbcin.com>
!Sender: "Tom" <dar...@fhlbcin.com>
!Subject: ThreadAbortException
!Date: Mon, 8 Sep 2003 06:48:49 -0700
!Lines: 23
!Message-ID: <397a01c3760f$eec3eb30$a301...@phx.gbl>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcN2D+7DEUmZiBdzRJGF6l57eoxCLw==
!Newsgroups: microsoft.public.vsnet.debugging
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.vsnet.debugging:3292
!NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
!X-Tomcat-NG: microsoft.public.vsnet.debugging
!
!I have read an article on Google that talks about this
!error when trying to do a Response.Redirect in .NET.
!
!The artice says if you use the overload the method and
!send in a "false" as a second parameter that the error is
!suppressed and you are redirected.
!
!ie.
!Response.Redirect(Application
!["ServerNameReadOnly"].ToString(),false);
!
!But I have found this to be false.
!
!I am still getting a "ThreadAbortException" error thrown
!when I try to redirect using the code above.
!
!
!Can anyone advise?
!
!Thanks
!
!Tom
!
!

Tom

unread,
Sep 9, 2003, 8:17:04 AM9/9/03
to
Yan-Hong:

My problem is that because the Responde.Redirect causes a
Response.End, my credentials are lost and my users have to
re-enter their credentials a second time! Is there
anything else I can do?

Thanks

Tom

PS Is this a "bug"? Has it been reported and will it get
fixed in the next SP?

>.
>

Yan-Hong Huang[MSFT]

unread,
Sep 10, 2003, 6:34:23 AM9/10/03
to
Hi Tom,

Since there is a KB on it, it is a known issue already. You could refer to
the status section of
http://support.microsoft.com/default.aspx?scid=KB;EN-US;312629 for more
info.

In this article, we could see that
For Response.Redirect, use an overload, Response.Redirect(String url, bool
endResponse) that passes false for the endResponse parameter to suppress
the internal call to Response.End.

So please use Response.Redirect(URL, false) instead. If it causes AV error,
I suggest you use a simple aspx page for testing.

Thanks very much.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Tom" <dar...@fhlbcin.com>
!Sender: "Tom" <dar...@fhlbcin.com>

!References: <397a01c3760f$eec3eb30$a301...@phx.gbl>
<tXdhmsn...@cpmsftngxa06.phx.gbl>
!Subject: RE: ThreadAbortException
!Date: Tue, 9 Sep 2003 05:17:04 -0700
!Lines: 113
!Message-ID: <52e901c376cc$478f5e90$a501...@phx.gbl>


!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300

!Thread-Index: AcN2zEePsyXL9hcUQr+BwMLxoEJVdQ==
!Newsgroups: microsoft.public.vsnet.debugging
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.vsnet.debugging:3304
!NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
!X-Tomcat-NG: microsoft.public.vsnet.debugging
!
!Yan-Hong:
!
!My problem is that because the Responde.Redirect causes a
!Response.End, my credentials are lost and my users have to
!re-enter their credentials a second time! Is there
!anything else I can do?


!
!Thanks
!
!Tom
!

!PS Is this a "bug"? Has it been reported and will it get
!fixed in the next SP?
!
!>-----Original Message-----
!>Hello Tom,
!>
!>Thanks for posting in the group.
!>
!>In ASP.NET 1.0 and 1.1, If you use the Response.End,
!Response.Redirect, or
!>Server.Transfer method, a ThreadAbortException exception
!occurs. You can
!>use a try-catch statement to catch this exception. .
!>
!>The cause of this issue is that the Response.End method
!ends the page
!>execution and shifts the execution to the
!Application_EndRequest event in
!>the application's event pipeline. The line of code that
!follows
!>Response.End is not executed.
!>
!>This problem occurs in the Response.Redirect and
!Server.Transfer methods
!>because both methods call Response.End internally.
!>
!>The way you used is correct to resolve this issue. For
!details, please
!>refer to MSDN article:
!>"PRB: ThreadAbortException Occurs If You Use
!Response.End,
!>Response.Redirect, or Server.Transfer"
!>http://support.microsoft.com/default.aspx?scid=kb;en-
!us;q312629
!>
!>However, if the exception is not caused by this issue,
!then it won't
!>resolve it. So please make sure that ThreadAbortException
!is caused by
!>Response.Redirect. I think you could test with a simple
!aspx page first.
!>
!>Does this answer your question?
!>
!>Best regards,
!>Yanhong Huang
!>Microsoft Online Partner Support
!>
!>Get Secure! - www.microsoft.com/security
!>This posting is provided "AS IS" with no warranties, and
!confers no rights.
!>
!>--------------------
!>!Content-Class: urn:content-classes:message
!>!From: "Tom" <dar...@fhlbcin.com>
!>!Sender: "Tom" <dar...@fhlbcin.com>
!>!Subject: ThreadAbortException
!>!Date: Mon, 8 Sep 2003 06:48:49 -0700
!>!Lines: 23
!>!Message-ID: <397a01c3760f$eec3eb30$a301...@phx.gbl>
!>!MIME-Version: 1.0
!>!Content-Type: text/plain;
!>! charset="iso-8859-1"
!>!Content-Transfer-Encoding: 7bit
!>!X-Newsreader: Microsoft CDO for Windows 2000
!>!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!>!Thread-Index: AcN2D+7DEUmZiBdzRJGF6l57eoxCLw==
!>!Newsgroups: microsoft.public.vsnet.debugging
!>!Path: cpmsftngxa06.phx.gbl
!>!Xref: cpmsftngxa06.phx.gbl
!microsoft.public.vsnet.debugging:3292
!>!NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
!>!X-Tomcat-NG: microsoft.public.vsnet.debugging
!>!


!>!I have read an article on Google that talks about this

!>!error when trying to do a Response.Redirect in .NET.


!>!
!>!The artice says if you use the overload the method and

!>!send in a "false" as a second parameter that the error
!is
!>!suppressed and you are redirected.
!>!
!>!ie.
!>!Response.Redirect(Application
!>!["ServerNameReadOnly"].ToString(),false);
!>!


!>!But I have found this to be false.
!>!
!>!I am still getting a "ThreadAbortException" error thrown

!>!when I try to redirect using the code above.
!>!
!>!


!>!Can anyone advise?
!>!

!>!Thanks
!>!
!>!Tom
!>!
!>!
!>
!>.
!>
!

0 new messages