Of Code and Me

Somewhere to write down all the stuff I'm going to forget and then need

301 redirects from Asp.Net February 9, 2010

Filed under: Asp.Net,guardian.co.uk,Uncategorized,Web — Rupert Bates @ 2:29 pm

Using Response.Redirect in Asp.Net will issue a 302 (temporary redirect) response. For items that have moved permanently you should issue a 301 (permanent redirect) using code such as:

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
    Response.StatusCode = (int) HttpStatusCode.MovedPermanently;
    Response.Status = "301 Moved Permanently";
    Response.AddHeader("Location", "http://www.my-redirect.co.uk/newhomepage.aspx");

Paul Roach the SEO lead at guardian.co.uk explains why this matters:
“301 redirects are preferable from an SEO point of view because they instruct the search engine to pass all of the value of the original page to the destination page, including link equity and page history / age. If you use 302 redirects the search engine considers it a temporary state and does not pass the value from the original page to the destination page, this can also lead to both pages being displayed in the index.”


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