blog

Home / DeveloperSection / Blogs / Response.Redirect() & Server.Transfer() in ASP.Net

Response.Redirect() & Server.Transfer() in ASP.Net

Sumit Kesarwani4444 10-May-2013

The Redirect method causes the browser to redirect the client to a different URL.Server.Transfer acts as an efficient replacement for the Response.Redirect method. Response.Redirect specifies to the browser to request a different page. Because a redirect forces a new page request, the browser makes two requests to the Web server, so the Web server handles an extra request. IIS 5.0 introduced a new function, Server.Transfer, which transfers execution to a different ASP page on the server. This avoids the extra request, resulting in better overall system performance, as well as a better user experience.

Say you have 2 pages (Page1 and Page2) where Page1 redirects to Page2.In case of 

1. Response.Redirect() : Search Engine will take this redirection asTemporary(Status 301) and always keep Page1 in its cache.

2. Server.Transfer() : Search Engine will be unaware of any redirection been took place (Status 200) and will keep Page1 to its database. It will think Page1 is producing the output response of Page2.

When to use:

1.    Response.Redirect() is perfect when your page is temporarily changed and will again be reverted to original within a short span of time.

2.   Server.Transfer() when you are thinking of keeping the page for ever, and to let search engine unaware of this redirection


Updated 18-Sep-2014

Leave Comment

Comments

Liked By