470,591 Members | 1,568 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Response.Redirect generates and Exception

Vi
Hi,
I have a try block in which I execute a Page.Response.Redirect("myPage.aspx");

This statement always generates the exception: "Thread was being aborted"
and the execution continues in the catch block.
Is there a way to execute Page.Response.Redirect without generating this
exception?
Or if not, is there at least a way to ignore this exception in the code?

Thank you.
Nov 18 '05 #1
1 1601
You can do Page.Response.Redirect("myPage.aspx", false);

this will tell it to continue processing the page and THEN redirect....thus
not causing the thread to be aborted....personally, I don't care much for
this solution (not that it's overly bad). What's the deal with the
exception being generated? You can ignore it by swallowing it:

try{
Response.Redirect("blah.aspx");
}catch (ThreadAbortException ex){ }
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Vi" <Vi@discussions.microsoft.com> wrote in message
news:DD**********************************@microsof t.com...
Hi,
I have a try block in which I execute a Page.Response.Redirect("myPage.aspx");
This statement always generates the exception: "Thread was being aborted"
and the execution continues in the catch block.
Is there a way to execute Page.Response.Redirect without generating this
exception?
Or if not, is there at least a way to ignore this exception in the code?

Thank you.

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Kerri | last post: by
1 post views Thread by Peter Kirk | last post: by
1 post views Thread by EagleRed | last post: by
1 post views Thread by Henry | last post: by
4 posts views Thread by Vi | last post: by
3 posts views Thread by jasonheath.net | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.