top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What is difference between Server.Transfer and Response.Redirect in .net?

0 votes
2,610 views
What is difference between Server.Transfer and Response.Redirect in .net?
posted Aug 5, 2014 by Sanjay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

Both Server.Transfer and Response.Redirect methods are used to transfer a user from one web page to another web page. Both methods are used for the same purpose but still there are some differences as follows. Both method has same syntax like:

Response.Redirect("MyFile.aspx");
Server.Transfer("MyFile.aspx");

The difference between them is that the Response.Redirect method redirects a request to a new URL and specifies the new URL while the Server.Transfer method for the current request, terminates execution of the current page and starts execution of a new page using the specified URL path of the page.

Picked following summary from the link which Akshay has suggested

                     Server.Transfer                            Response.Redirect
Redirection    Redirection is done by the server.           Redirection is done by the browser client.
Browser URL    Does not change.                             Changes to the redirected target page.
When to use    Redirect between pages of the same server.   Redirect between pages on different server and domain.
answer Aug 5, 2014 by anonymous
0 votes

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

Both Response.Redirect and Server.Transfer has same syntax like:

Response.Redirect("UserDetail.aspx");
Server.Transfer("UserDetail.aspx");

answer Nov 15, 2014 by Manikandan J
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...