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!
|
| Author: kiran Sattenapalli 04 Jul 2005 | Member Level: Bronze Points : 0 |
Its good
|
| Author: Prashant Pandey 12 Dec 2007 | Member 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 2011 | Member 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 2011 | Member 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 2011 | Member 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 2011 | Member 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 2011 | Member Level: Gold Points : 0 |
Its really nice resource and valuable feedbacks too.
Thanks, Himanshu
|