Net-informations.com
SiteMap  | About    

Server.Transfer VS Response.Redirect

Server.Transfer and Response.Redirect both are used to transfer a user from one page to another. Both Response.Redirect and Server.Transfer has same syntax like:

Above two methods are used for the same purpose but still there are some differences as follows.

Response.Redirect() sends a redirection header to the client , and the client itself requests the new page while the Server.Transfer method for the current request, terminates execution of the current page and starts execution of a new page using the specified URL path of the page.

Usage

Response.Redirect should be used when:

  1. Redirect the request to some plain HTML pages on our server or to some other web server

  2. Don't care about causing additional roundtrips to the server on each request

  3. Do not need to preserve Query String and Form Variables from the original request

  4. Users to be able to see the new redirected URL where he is redirected in his browser

Server.Transfer should be used when:

  1. Transfer current page request to another .aspx page on the same server

  2. Preserve server resources and avoid the unnecessary roundtrips to the server

  3. Preserve Query String and Form Variables (optionally)

  4. Don't need to show the real URL where we redirected the request in the users Web Browser









net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.