Response.Redirect vs. Response.AddHeader vs. Server.Transfer

All these three are used to redirect the user from one location to another, but there are subtle differences.

Response.Redirect

  • Creates a whole new HTTP request to a new Url.
  • Produces a 302 http status code
  • Equivalent to ‘Temporary Redirect’ and the old Url is retained in search indexes. There won’t be any transfer of metrics.

Response.Redirect

Response.AddHeader on Location

  • Creates a whole new HTTP request to a new Url. (Common with Response.Redirect)
  • Produces a 301 http status code
  • The new Url is indexed instead by searchbot. There will be some loss of page rank / traffic value, but the stats will get transferred over.

Response.AddHeader

Server.Transfer

  • This doesn’t change the current Url
  • An internal transfer is done on the server during execution path without creating a new HttpRequest.
  • FYI, the ‘rewrite’ option in the IIS urlrewrite module does a Server.Transfer.

server-transfer

Advertisements

, ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: