Possible Duplicates:
Response.Redirect vs. Server.Transfer
Server.Transfer Vs. Response.Redirect
What is the difference between response.redirect and server.transfer? Only one difference i know is: In response.redirect the browser url changes to targeted page as well as in server.transfer the url remains same! any other difference?
Response. Redirect simply sends a message (HTTP 302) down to the browser. Server. Transfer happens without the browser knowing anything, the browser request a page, but the server returns the content of another.
Redirect from one application to another application, it will be redirected. It means that we cannot be redirected out of the server application using server. Transfer that is only used for navigating within the same application.
For instance, instead of a "form" button that causes a postback and redirect, you could use a LinkButton that will behave like a hyperlink, allowing the browser to request the new page directly.
Transfer ends the current web form and begin executing a new web form. Server. Execute begins executing a new web form while still displaying the current web form. The contents of both forms are combined.
Response.Redirect should be used when:
we want to redirect the request to some plain HTML pages on our server or to some other web server
we don't care about causing additional roundtrips to the server on each request
we do not need to preserve Query String and Form Variables from the original request
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 should be used when:
we want to transfer current page request to another .aspx page on the same server
we want to preserve server resources and avoid the unnecessary roundtrips to the server
we want to preserve Query String and Form Variables (optionally)
we don't need to show the real URL where we redirected the request in the users Web Browser
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With