dotnetspider.com


 


TutorialsForumResourcesReviewsJobsInterviewVideosCommunitiesProjectsTraining

Subscribe to Subscribers


Online MembersAnu George
Shesh Kumar Mishra
saranya
Anil Kumar Pandey
Suneetha
amol
sravan
chaminda
sandy
Prasad kulkarni
recherche
More...




Resources » Articles » ASP.NET/Web Applications


What is the difference between Server.Transfer and Response.Redirect


Posted Date:     Category: ASP.NET/Web Applications    Rating: 1 out of 5
Author: Member Level: Gold    Points: 10


This short article explains the difference between Response.Redirect and Server.Transfer.


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")


Did you like this resource? Share it with your friends and show your love!





Responses to "What is the difference between Server.Transfer and Response.Redirect"
Author: kiran Sattenapalli    04 Jul 2005Member Level: Bronze   Points : 0
Its good


Author: Prashant Pandey    12 Dec 2007Member Level: Bronze   Points : 0
Hi roop, for this particular question, take a look of the following article...
http://techahead.wordpress.com/2007/10/14/aspnet-servertransfer-vs-responseredirect/



Author: Khaleek    05 Jan 2011Member Level: Bronze   Points : 1
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.




Author: Jayendra Kumar    06 Jan 2011Member Level: Gold   Points : 1
using Response.redirect we can redirect user to another domain but using Server.transfer we can not transfer user to another domain. Server.transfer transfer user to another page in the same server.


Author: periyannan    16 May 2011Member Level: Bronze   Points : 1
In Server.Transfer, we must give ASPX page only.. like

Server.Transfer("xxx.aspx");
Server.Transfer("www.google.com")---->Its not work

In Response.Redirect we can give ASPX page link and URL link also.

Response.Redirect("xxx.aspx")
Response.Redirect("www.google.com")--->Both will work(If not work,add http in front



Author: Ali    01 Jun 2011Member Level: Silver   Points : 1
Hello,
The major difference between Server.Transfer and Response.Redirect Is Response.redirect provides a roundtrip to the server and server.transfer does not.

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.

Example:
Response.Redirect("WebForm1.aspx")
Response.Redirect("www.google.com/")

Server.Transfer saves server resources. Instead of telling the browser to redirect, it simply changes the "focus" on the Web server and transfers the request.

Hope this helps you!

Thanks & regards
Ali



Author: Himanshu Patel    09 Jun 2011Member Level: Gold   Points : 0
Its really nice resource and valuable feedbacks too.

Thanks,
Himanshu



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Page Architecture - ASP.NET 2.0
    Previous Resource: Useful Tools for .Net developers
    Return to Resources
    Post New Resource
    Category: ASP.NET/Web Applications


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Points  .  Response.Redirect  .  Server.Transfer  .  Difference  .  

    My Profile

    Active Members
    TodayLast 7 Daysmore...


    Awards & Gifts


    Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds



    About Us    Trademark Disclaimer    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.