IT Community - Software Programming, Web Development and Technical Support

Difference between Server.Transfer and Response.Redirect

This is a discussion on Difference between Server.Transfer and Response.Redirect within the ASP and ASP.NET Programming forums, part of the Web Development category; The difference between Server.Transfer and Response.Redirect Response.Redirect: This tells the browser that the requested page can be ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 08-30-2007, 09:04 AM
Arun Arun is offline
D-Web Trainee
 
Join Date: Mar 2007
Posts: 43
Arun is on a distinguished road
Post Difference between Server.Transfer and Response.Redirect

The difference between Server.Transfer and Response.Redirect

Response.Redirect:

This tells the browser that the requested page can be found at a new location. The browser then initiates another request to the new page loading its contents in the browser. This results in two requests by the browser.

Server.Transfer:

It transfers execution from the first page to the second page on the server. As far as the browser client is concerned, it made one request and the initial page is the one responding with content. The benefit of this approach is one less round trip to the server from the client browser. Also, any posted form variables and query string parameters are available to the second page as well.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-31-2007, 01:05 AM
krishnakumar krishnakumar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 206
krishnakumar is on a distinguished road
Wink Re: Difference between Server.Transfer and Response.Redirect

Hi,

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 accros 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.

Response.Dedirect() :client know the physical loation (page name and query string as well). Context.Items loses the persisitance when nevigate to destination page. In earlier versions of IIS, if we wanted to send a user to a new Web page, the only option we had was Response.Redirect. While this method does accomplish our goal, it has several important drawbacks. The biggest problem is that this method causes each page to be treated as a separate transaction. Besides making it difficult to maintain your transactional integrity, Response.Redirect introduces some additional headaches. First, it prevents good encapsulation of code. Second, you lose access to all of the properties in the Request object. Sure, there are workarounds, but they’re difficult. Finally, Response.Redirect necessitates a round trip to the client, which, on high-volume sites, causes scalability problems.

As you might suspect, Server.Transfer fixes all of these problems. It does this by performing the transfer on the server without requiring a roundtrip to the client.

Examples:

Server.Transfer

Server.Transfer("Webform2.aspx")

Response.Redirect

Response.redirect("Webform2.aspx")
__________________
Krishnakumar.S
Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-07-2007, 03:02 AM
H2o H2o is offline
D-Web Analyst
 
Join Date: Jul 2007
Posts: 246
H2o is on a distinguished road
Default Re: Difference between Server.Transfer and Response.Redirect

Difference between Server.Transfer and Response.Redirect

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 accros 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.

Response.Dedirect() :client know the physical loation (page name and query string as well). Context.Items loses the persisitance when nevigate to destination page. In earlier versions of IIS, if we wanted to send a user to a new Web page, the only option we had was Response.Redirect. While this method does accomplish our goal, it has several important drawbacks. The biggest problem is that this method causes each page to be treated as a separate transaction. Besides making it difficult to maintain your transactional integrity, Response.Redirect introduces some additional headaches. First, it prevents good encapsulation of code. Second, you lose access to all of the properties in the Request object. Sure, there are workarounds, but they’re difficult. Finally, Response.Redirect necessitates a round trip to the client, which, on high-volume sites, causes scalability problems. As you might suspect, Server.Transfer fixes all of these problems. It does this by performing the transfer on the server without requiring a roundtrip to the client.
__________________
H2O

Without us, no one can survive..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-19-2007, 10:12 PM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default Re: Difference between Server.Transfer and Response.Redirect

ResponsetoRedirect:
Response.Redirect can be used to redirect to external web sites.

Server.Transfer:
Server.Transfer can be used only to transfer to other pages of the same web site.
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.
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-19-2007, 10:52 PM
krishnakumar krishnakumar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 206
krishnakumar is on a distinguished road
Smile Re: Difference between Server.Transfer and Response.Redirect

Hi,
Can we transfer the values also from one page to another page using server.transfer.... I need to take value from one page and transfer to anotherpage.. Can anyone help me?...
__________________
Krishnakumar.S
Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/asp-asp-net-programming/3568-difference-between-server-transfer-response-redirect.html
Posted By For Type Date
DiscussWeb IT Community - Technical Support and Technology Discussions This thread Refback 08-30-2007 10:36 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
The server rejected one or more recipient addresses. The server response was: 550 5.7 poornima ASP and ASP.NET Programming 7 02-29-2008 01:07 AM
What is the difference between Server.Transfer and Response.Redirect?.. H2o ASP and ASP.NET Programming 4 11-22-2007 05:25 AM
example of Server.Transfer and Context Handler hanusoft ASP and ASP.NET Programming 1 09-06-2007 07:08 AM
If I use Response.Redirect in try block exception occurred in c#, Why? kingmaker C# Programming 1 07-19-2007 04:51 AM
What is the difference between Server.Transfer and Response.Redirect? Why would I cho prasath ASP and ASP.NET Programming 1 07-19-2007 02:41 AM


All times are GMT -7. The time now is 03:31 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0