Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET4.0
Difference between Response.Redirect and Server.Transfer.Where we have to use these two with example.
Posted 12-Jul-12 9:22am
Aiyal416
Comments
Wes Aday at 12-Jul-12 14:32pm
   
Pasting your text into google produces over 80000 results. Do you have a specific question?
Gaurav.Kumar.Arora at 30-Oct-14 17:14pm
   
There are lot of articles and blog posts in CodeProject, you can refer to those
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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.
 
Here, read:
Response.Redirect[^]
Vs
Server.Transfer[^]

Response.Redirect
sends HTTP code 302 down to the users browser along with the new URL location of the wanted page. HTTP Code 302 actually means ' The requested resource resides temporarily under a different URI'.
BUT
Server.Transfer do not initiates another request to the server, but the original request is simply rewritten and transfered to some other page on the same server.
 
Then these:
What is the difference between Server.Transfer and Response.Redirect methods? [^]
Difference between Server.Transfer() and Response.Redirect()[^]
 

Summary:
    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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Following are the major differences between them:-
√ 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. In response.redirect you can maintain the state, but has
lot of drawbacks.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

The main difference between them is who does the transfer. In "response.redirect" the transfer is done by the browser while in "server.transfer" it’s done by the server.
 
Below is a great video which explains the same in more detail.
 
https://www.facebook.com/photo.php?v=762186150488997[^]
  Permalink  
v2
Comments
Shivprasad koirala at 20-May-14 7:12am
   
Not sure this question was updated or looked new so answered it.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

  Permalink  
Comments
CHill(Hawkeye)60 at 20-May-14 6:50am
   
Homework question was posted 2 years ago
King_Fisher at 20-May-14 7:10am
   
i saw this Question at Top of the Quick Answers List.so i thought new Question ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,327
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,920


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 19 May 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100