Hi
What is the difference between Server.Transfer and Response.Redirect ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted May 14, 2012, 1:49 PM
Response.Redirect sends a response to the client browser instructing it to request the second page. This requires a round-trip to the client, and the client initiates the Request for the second page. Server.Transfer transfers the process to the second page without making a round-trip to the client. It also transfers the HttpContext to the second page, enabling the second page access to all the values in the HttpContext of the first page
Server.Transfer: client is shown as it is on the requesting page only, but the all the content is of the requested page. Data can be persist across the pages using Context.Item collection, which is one of the best way to transfer data from one page to another keeping the page state alive.
Server.Transfer transfers execution directly to another page. Response.Redirect sends a response to the client and directs the client (the browser) to load the new page (it causes a roundtrip). If you don't need to execute code on the client, Transfer is more efficient.
Response.Redirect
1.we want to redirect the request to some plain HTML pages on our server or to some other web server
2.we don't care about causing additional roundtrips to the server on each request
3.we do not need to preserve Query String and Form Variables from the original request
4.we want our users to be able to see the new redirected URL where he is redirected in his browser (and be able to bookmark it if its necessary)
Server.Transfer
1.we want to transfer current page request to another .aspx page on the same server
2.we want to preserve server resources and avoid the unnecessary roundtrips to the server
3.we want to preserve Query String and Form Variables (optionally)
4.we don't need to show the real URL where we redirected the request in the users Web Browser
Thanks