views:

133

answers:

2

Hi

I know there is several ways to change the current page in ASP.Net. So, by Redirecting to a new page, what will happen to the thread we were running it in the prev. page?

A: 

It will be returned to the ASP.NET thread pool.

Mitch Wheat
Ganesh R.
@Ganesh R:Could you show us your code, maybe in a separate post?
Kb
@Ganesh R.: why do you stop a thread? Please post your code...
Mitch Wheat
Posted it: http://stackoverflow.com/questions/1185031/cannot-transfer-request-to-desired-asp-net-error-page
Ganesh R.
+2  A: 

The Response.Redirect method uses an exception to exit out of the current page creation cycle, and sends a redirection page back in the response to the browser. The thread then finishes off the Page object and returns to the pool just like when a regular page is complete. The browser handles the redirection page and sends a new request to the server, so the redirected page is a completely new request that has no direct relation to the first request.

The Server.Transfer method will end the current page execution and continue with the target page without doing a round trip to the server.

The Server.Execute method will execute the target page, then return to continue the rest of the code in the original page.

Guffa
+1 for your great answer, but could you please explain more about "The thread then finishes off the Page object and returns to the pool just like when a regular page is complete" ? by the way, "round trip" phrase in web applications means sending data to server and client. Am I right?
odiseh