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
MarkPut 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.
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Jimi" <dontspam@.me.com> wrote in message
news:uls70dBXGHA.1352@.TK2MSFTNGP05.phx.gbl...
> 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
>
>
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
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:eaqxRZEXGHA.3660@.TK2MSFTNGP04.phx.gbl...
> 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.
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "Jimi" <dontspam@.me.com> wrote in message
> news:uls70dBXGHA.1352@.TK2MSFTNGP05.phx.gbl...
>
Yes, that's what I'm suggesting. Does it work for you?
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Jimi" <dontspam@.me.com> wrote in message
news:efW%23QfEXGHA.4324@.TK2MSFTNGP03.phx.gbl...
> 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
> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
> news:eaqxRZEXGHA.3660@.TK2MSFTNGP04.phx.gbl...
>
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
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:OlCNUwFXGHA.3848@.TK2MSFTNGP05.phx.gbl...
> Yes, that's what I'm suggesting. Does it work for you?
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "Jimi" <dontspam@.me.com> wrote in message
> news:efW%23QfEXGHA.4324@.TK2MSFTNGP03.phx.gbl...
>
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
"Jimi" <dontspam@.me.com> wrote in message
news:uq2px$FXGHA.752@.TK2MSFTNGP02.phx.gbl...
> 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
>
>
> "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
> news:OlCNUwFXGHA.3848@.TK2MSFTNGP05.phx.gbl...
>
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment