Thread was being aborted error message

J

Jimi

Hi all, I have a user control which raises an event to the parent page when
a person clicks on a link in a datagrid.

In the event handler inside the parent page I construct a url to redirect to
containing information sent from the datagrid.

It all works fine on my local machine but when I send it to the live server
I receive "The thread was being aborted"

Doing some googling suggested that I use

Response.Redirect("./myurl.aspx?ID=" + variable,false);

to allow the current thread to continue executing.

This stops the error but what I am now finding is that the redirect does not
have the querystring attributes attached to it..

e.g. instead of looking like this...

http://www.website.com/myurl.aspx?ID=5

it looks like

http://www.website.com/myurl.aspx


It's like the redirect *never* happens....

Help appreciated
Thanks
Mark
 
S

Steve C. Orr [MVP, MCSD]

Put your Response.Redirect back to the way it was, without the false
parameter.
Then wrap it in a Try/Catch statement to eat the error that's raised from
the redirect.
 
J

Jimi

Hi Steve, you mean like this???

try
{
Response.Redirect("./myurl.aspx?ID=" + variable);

}catch (Exception ex)
{

}

I have seen other people say take the Response.Redirect("./myurl.aspx?ID=" +
variable,false) out of the try catch block...
I understand why this is hapenning but cannot understand how to fix it...

Thanks again Steve..
Cheers
Mark
 
J

Jimi

Hi Steve, no unfortunately not.

I did a try catch and caught the exception like so:

catch (Exception ex)

Output of ex.Message was Thread was being aborted.
and ex.Source = mscorlib

Thanks again for your help
Cheers
Mark
 
J

Jimi

Hi all, in the end due to time constraints I used a JavaScript redirect and
now it all works fine.

Thanks for your help Steve :)
Cheers
Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top