Server.Transfer x Response.Redirect

Every web developer must have heard Response.Redirect, but not everybody has used Server.Transfer. Ok, that might be a wrong statement.

The point is, both Response.Redirect and Server.Transfer will send users to another page, what really are the differences? Here you go:

  1. Server.Transfer doesn’t actually redirect user’s browser.
    The transfer occurs on server’s side and do not first reach the client. So, calling Server.Transfer("about.aspx") from contact.aspx’s page load event will send user directly to about.aspx without round trip to the client.
  2. Server.Transfer can’t send users to external site other than yours.
    Since it occurs on server’s side, we can’t use it to transfer to external side other than our domain.
  3. Server.Transfer doesn’t change the original Url.
    Take an example above, when user requests contact.aspx, the server will return about.aspx content, however, the url will still be contact.aspx.
  4. Server.Transfer can also transfer form data and query strings.
    If there is any form data or query string in contact.aspx, it will also get transferred to about.aspx.
Advertisements

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s