Difference between Response.Redirect() and Server.Transfer() ?

Response.Redirect

Response.Redirect() is the most common way of redirecting a user from one web-page to another. For example, Whenever you write Response.Redirect("~/default.aspx") in the code, server sends the response to browser with 302 status code. It also sends the location where the browser needs to redirect the user in Location header in the response. So, whenever, the browser receives 302 status code, it looks for Location header in the response and redirects the user to that web page.

Server.Transfer

Server.Transfer() is the way of redirecting a user from the server. For example, if you write Server.Transfer("~/default.aspx") in code, the server will redirect user to default.aspx page & will display the response provided by default.aspx page.

Differences between Response.Redirect() and Server.Transfer()

  1. In Response.Redirect(), it's browser's responsibility to redirect the user to a web-page while in Server.Transfer() it is Server's responsibility.
  2. In Response.Redirect(), URL changes to the new one while in Server.Transfer() URL doesn't changes.
  3. Server.Transfer() is faster than Response.Redirect().

Interview Questions by Technologies
This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. For more information - please visit our private policy.