What is the difference between Server.Transfer() and Response.Redirect()?


  • Response.Redirect() can jump from one server to another but Server.Transfer() navigates within the same server only
  • The URL of the page does not change in case of Server.Transfer(), as it copies the requested page on the current page, so it is difficult to recognize the current page if developers are using Server.Transfer() and require the current page URL
  • Response.Redirect() takes many round trips to the server so it is little bit slower in comparison with Server.Transfer()
  • The Server.Transfer() method has a second parameter—"preserveForm". If you set this to “True”, using a statement such as Server.Transfer("WebForm2.aspx", True), the existing query string and any form variables will still be available to the page you are transferring to. The values can be retrieved using the method “Request.Form("<control name>")

Comments

Popular posts from this blog

jQuery Basics

What is the difference between a Page Layout and Master Page in SharePoint?

Accessing data from SharePoint 2010 to an ASP.NET application