Difference Between Server.Transfer vs Response.Redirect

Manisky2000
Posted by in ASP.NET category on for Beginner level | Views : 35398 red flag
Rating: 5 out of 5  
 1 vote(s)

By the Following code sample attachement, This concept will be more understandable. Make use of it.


 Download source code for Difference Between Server.Transfer vs Response.Redirect

Introduction
The data transfering between two page will be more differ on server.Transfer() and Response.Redirect().

Server.Transfer



Server.Transfer() helps the one less round trip. The main advantage of this transfer the first page to second page with better performance. The data can pass through variables, query string and also can retrive from the previous page control value.

Eg: Server.Transfer("Default.aspx");

Response.Redirect()


It is very similar to server.Transfer. The main difference is the posted pervious page values can't be accessable. Here also the data can pass through server variables and query string. It simply redirect the page from one page to another.

Eg: Response.Redirect("Default.aspx")

Note: But the pervious page values can't be accessable by Response.Redirect().

By the Following code setup attachement, This concept will be more understandable. Make use of it.

 

Default.aspx

Just adding required Controls.




Default.aspx.cs

Here, The Default page is transfer to Default2.aspx.


Default2.aspx.cs

If the pervious page is used Server.Transfer(), then this following code will find the Default page Control (txtSample).

Conclusion

By the way according to the requirement we can transfer one page to another page.

Formatting edited by: Webmaster on 20-Oct-2008.

Page copy protected against web site content infringement by Copyscape

About the Author

Manisky2000
Full Name: Manikandan Ravi
Member Level: Starter
Member Status: Member
Member Since: 10/13/2008 11:32:19 PM
Country:



Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)