What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

Showing Answers 1 - 30 of 30 Answers

Rama Krishna

  • Aug 21st, 2005
 

Server.Transfer is used when redirecting the webpage with in the same applicationwhereasResponse.Redirect is applicabletowards the redirection of webpage between 2 applications 
 
Response.Redirect will instruct browser to call a particular webpage.This will increase one request and one response between the client and server.

  Was this answer useful?  Yes

Anil kumar

  • Sep 1st, 2005
 

i want to add two more comment to the previous one 
 
 
Resonse.redirect can be used both for aspx and html pages.But server.transfer is only used for aspx pages it will not work for html pages. 
 
Response.redirect will only only get method to post variables form one page to another means we need to give in query string if we want to pass some variables to next page. 
 
But in server.transfer if we selected the second attribute to "TRUE" then it will post all the variable using the post method.

Leelakrishnan

  • Sep 19th, 2005
 

Response.redirect provides a roundtrip to the server and server.transfer does not. For details search microsoft IIS help

Also Response.redirect redirects both the html page as well as the aspx page where as the server.transfer  transfers the  control only to the aspx pages

Praveen Kumar

  • Sep 23rd, 2005
 

Response.Redirect can be used to redirect to external web sites where as the Server.Transfer can be used only to transfer to other pages of the same web site.

  Was this answer useful?  Yes

Madhuri.Ch

  • Oct 6th, 2005
 

response.redirect necessesitates a round trip to the client and also has no support for encapsulating the code.whereas with a server.transfer we can overcome these overheads because server.transfer gets teh page from the server itself without needing a rountrip to the client.

  Was this answer useful?  Yes

Raja Mukherjee

  • Oct 17th, 2005
 

Server.transfer transfer the page processing from one page to another page without making a round trip back to the client where as response.redirect redirect to another URL and it make a round trip back to the client.

Server.transfer can not transfer page processing from one page to another if the transferred page is in separate application.

  Was this answer useful?  Yes

Manas Behera

  • Jul 27th, 2006
 

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over th
 
Server.Transfer is used when redirecting the webpage with in the same application whereas Response.Redirect is applicable towards the redirection of webpage between 2 applications 

In case of Server.Transfer the browser's history is not updated but in Response.Redirect the browser's history is updated

In case of Server.Transfer the url is not changed but in Response.Redirect the url is  changed

  Was this answer useful?  Yes

Dhrani

  • Jul 28th, 2006
 

i want to add two more comment to the previous one 
 
 
Resonse.redirect can be used both for aspx and html pages.But server.transfer is only used for aspx pages it will not work for html pages. 
 
Response.redirect will only only get method to post variables form one page to another means we need to give in query string if we want to pass some variables to next page. 
 
But in server.transfer if we selected the second attribute to "TRUE" then it will post all the variable using the post method.

  Was this answer useful?  Yes

shilpa

  • Aug 19th, 2006
 

Whenever we use Server.Transfer method,it just clears the contents of that page and loads the contents of the page which to be loaded.But url wont change.In Response.Redirect it just redirects to othe pages(url also changes)

  Was this answer useful?  Yes

Ranjay Kr. Singh

  • Jun 10th, 2007
 

Server.Transfer can be use only. aspx page, but Response.Redirect in used both .aspx and html page·


Response. Redirect will only get method to post variables form one page to another means we need to give in query string if we want to pass some variables to next page. But in Server.Transfer if we selected the second attribute to "TRUE" then it will post the entire variable using the post method.· Server.Transfer method is quickly way to redirect to another page without round trip.As a result the URL that’s display in client browser won’t be changed.

  Was this answer useful?  Yes

Arijit Pal

  • Sep 21st, 2007
 

Server.Transfer
----------------
1) There is no round trip in case of Server.Transfer
2) URL of the new page is not reflected by the browser's address bar
because the transfer takes place entirely on the server—no client redirection ever occurs.
3) The same application object that was serving the caller request now serves the present page, thus limiting the impact on the ASP.NET infrastructure.
4) Unlike Response.Redirect("....") where any page(.aspx/.html) outside the current application can be called,
Server.Transfer can transfer call to another .aspx page within the application only.

  Was this answer useful?  Yes

prashanthdd

  • Apr 28th, 2008
 

Server.Transfer transfers the page processing from one page to another without making a round trip back to the client browser.This provides faster response with a little less overhead on the server.Server.Transfer doesn't update the client's url history list or current url.
Response.Redirect redirects the client browser from one page to another page or site.This performs as a round trip back to the client browser where the user's browser is redirected to the new page.Response.Redirect updates the client's url history list to reflect the new address.

  Was this answer useful?  Yes

shubha ss

  • Jul 9th, 2008
 

Response.Redirect sends message to the browser saying it to move to some
different page, while server.transfer does not send any message to the browser
but rather redirects the user directly from the server itself. So in server.transfer
there is no round trip while response.redirect has a round trip and hence puts
a load on server.

 Using Server.Transfer you can not redirect to a different from the server itself.
Example if your server is www.yahoo.com you can use server.transfer to move
to www.microsoft.com but yes you can move to www.yahoo.com/travels, i.e.
within websites. This cross server redirect is possible only using
Response.redirect.

With server.transfer you can preserve your information. It has a parameter
called as “preserveForm”. So the existing query string etc. will be able in the
calling page.

  Was this answer useful?  Yes

1) Server.Transfer: Shifts the exection from current to the requested page with same session ID.

2) Response.Redirect: redirection to the pointed URL.

Mohammed Yousuf uddin
Software Developer

  Was this answer useful?  Yes

1) server.Transfer is used for redirecting the user from one page to another this is only for those applications which are running on the same server
where as
Response.Redirect is used for the applications which are running on different server.

2) There is a round trip in Response.Redirect
where as
in the server.Transfer only the data is getting loaded in the same browser means there is no round trip in server.Transfer.

3) Response.Redirect is used in .HTML and .ASPX pages
where as
server.tranfer is used in .ASPX pages only.

4) In response.redirect URL is changed for the new page
where as
in server.transfer the URL remains same.

5)In Response.redirect by default page method is get method means if u want to transfer any data from one page to another then you will have to keep this in query string or session
where as
in server.transfer default method is post method means all the data from previous page get transferred to new page .

6)In server.transfer you will not able to save the history in browser
where as
in Response.redirect the browser history is saved and updated.

  Was this answer useful?  Yes

1) In Response.Redirect previous page is not accessible while in Server.Transfer it is optional.
Server.Transfer(URL,bPreserveForm);

2) Server.Transfer use only within the server.But Response.Redirect can be use ouside the server.But it should be a full path like http://www.google.com only www.google.com will not work.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions