Difference Between Server.Transfer and Response.Redirect Asp.Net Interview Question

There is a common question for developers in Asp.net interview board that “What is the difference between Response.Redirect and Server.Transfer“. In a common term we can use both to redirect the user from source page to destination page. But there are some differences in between Response.Redirect and Server.Transfer, which i want to share with you.

1. A round trip occurs to the client before loading the destination page, which means after redirecting a page from source page to destination page a round trip occur into the client to update the address bar and history of the client browser. And also the destination page will be loaded by initiating a new request which is the 2nd request to the server.
2. To pass data in this mechanism you can easily use Query String or Session value.

1.It is a single request from source page to destination page. The destination.aspx will be loaded from the server without a 2nd request. Means it will not update the address bar and history of the browser.
2. You will get better performance.
3. You cannot use Query String.
4. To pass data between souce.aspx page to destination.aspx by using HttpContext object.
5. You can also use session object to transfer data.
6. Users can not bookmark the destination.aspx page.

Posted in .Net, Asp.net, Asp.net C# Vb.net Interview Question, C#, VB.Net

Leave a Reply

Your email address will not be published. Required fields are marked *