Home > Interview Questions > ASP.NET > What is difference between Response.Redirect and Server.Transfer in asp.net?

What is difference between Response.Redirect and Server.Transfer in asp.net?

by Thamil   on 04/10/2015   Category: ASP.NET   |  Level: Intermediate   |  Views: 895    |  Points: 25     |  Gold 


Server.Transfer

1. Server.Transfer is used to transfer the user from one page to other page. Suppose if you want to transfer the user from test1.aspx to test2.aspx, Server.Transfer does not change the URL after displaying the test2.apx URL will remain same – test1.aspx but content would be test2.aspx.
2. Within single request server would redirect to another page, so it avoids the unnecessary round trips and redirect page with single round trip
3. Server.Transfer will work only when the requested page resides in same server and i.e. we can’t transfer from www.testweb1.com to www. Testweb2.com by using Server.Transfer.

Response.Redirect

1. Response.Redirect is also used to transfer the user from one page to other page. When you transfer the target page, Response.Redirect would change the URL.
2. Additional round trips required to transfer the page.
3. Response.Redirect will work when you transfer the page to another page which is residing in different server or different domain also it will work the requested page resides in same server.

Note: Use Server.Transfer() when you transfer the user between pages of the same server or domain. Use Response.Redirect() method to transfer the user between pages on different server or domain.


« What is web form in asp.net application?
» What is Query String in asp.net?
Post Question  |  Question Home

Recent Posts

User Responses


No response found, be the first to review this question.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts