Response.Redirect as "END"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does a call to Response.Redirect result in an immediate exit from the current
page function (i.e. a "return()")? I want to make sure that the statements
after the Response.Redirect() do not get called.

Alex
 
Response.Redirect has an overload with a second Boolean parameter that, when
true, will immediately end the current page execution and send and HTTP
redirect header to the client.

Response.Redirect ("default.aspx", true);

- Steve
 
Just be careful about Response.Redirect with the second Boolean
parameter set to True inside a try-catch block. This would generate an
exception (ThreadAbort).

André Nobre
 
Hi Alex,

By default Response.Redirect will end the current http request and send
redirect info to client-side so that client side browser will perform
redirecting. And When end the current request, the runtime will abort the
current executing worker thread, in this case, no other code will get
executed on the thread.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
The overload without the second parameter does the same as when the
second parameter is set to true.

Response.Redirect ("default.aspx", true);

and

Response.Redirect ("default.aspx");

are equivalent.
 

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

Back
Top