mobile ads

Wednesday 16 October 2013

Difference between Response.Redirect and Server.Transfer

Response.Redirect involves an extra round-trip to the server whereas Server.Transfer conserves server resources by avoiding that extra round-trip. Server.Transfer just changes the focus of the page by directly communicating with server.
         Response.Redirect
  1. Response.Redirect() will send you to a new page, update the address bar and add it to the Browser History. On your browser you can click back.
  2. It redirects the request to some plain HTML pages on our server or to some other web server.
  3. It causes additional roundtrips to the server on each request.
  4. It doesn’t preserve Query String and Form Variables from the original request.
  5. It enables to see the new redirected URL where it is redirected in the browser (and be able to bookmark it if it’s necessary).
  6. Response. Redirect simply sends a message down to the (HTTP 302) browser. 


  1. Server.Transfer
  2. Server.Transfer() does not change the address bar, we cannot hit back.One should use Server.Transfer() when he/she doesn’t want the user to see where he is going. Sometime on a "loading" type page.
  3. It transfers current page request to another .aspx page on the same server.
  4. It preserves server resources and avoids the unnecessary roundtrips to the server.
  5. It preserves Query String and Form Variables (optionally).
  6. It doesn’t show the real URL where it redirects the request in the users Web Browser.
  7. Server.Transfer happens without the browser knowing anything, the browser request a page, but the server returns the content of another.

2 comments:

RAMRAJ QA said...

Nice Post..
Please give program example..

thanks & regards.

manju said...

Hi Ram,
Thanks

Response.Redirect("http://manjuguntu.blogspot.in");

Response.Redirect method has two signatures with the second format accepting another Boolean parameter that signals whether execution of the current page should terminate. We could tell the system to continue execution of the current page while redirecting the user to the new page with the following snippet:

Response.Redirect("http://manjuguntu.blogspot.in", false);

And Server.Transfer
Server.Transfer("/default.aspx");

Post a Comment