301 redirection in ASP.NET

As I don't want to register my personal website domain (KeyvanNayyeri.Com) for next year today redirected it to Nayyeri.NET to move my links popularity and PageRank to here.

Bellow this post I've posted about the code I used to implement 301 redirect in ASP.NET as a SEO friendly redirection:

First created a page with this code then set it as my customError page in Web.Config so all incoming requests are redirecting to Nayyeri.NET with 301 redirect.

P.S. Note that my domain will expire in next 3 months so my email addresses on KeyvanNayyeri.Com will not be valid in the future.

Here is my description about the code I've used:

Sometimes you need to move users from a website to another. There are two choices available: 301 and 302 redirects. Here I'm going to describe each one and implement 301 redirection as SEO friendly redirection in ASP.NET.

301 redirect

It's used when we want to redirect a website to another with its link popularity and PageRank. SEOs love this kind of redirections. 301 redirect shows that a website has been transferred permanently to new website.

302 redirect

This kind of redirection is not SEO friendly. 302 redirect shows that a website has been transferred temporary to new website. Avoid using this redirection.

301 redirection implementation in ASP.NET

These two kinds of redirections are implemented in client or server side technologies. Here I'm going to show it in ASP.NET:

Response.Redirect() uses 302 redirects by default so we can't use it if want to implement 301 redirects.

Using following code we can implement 301 redirects with Response object:

 

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    'Put user code to initialize the page here

    Response.Status = "301 Moved Permanently"

    Response.AddHeader("Location", "http://www.nayyeri.net/")

End Sub

That's it! This redirection is SEO friendly and can improve your new website in search engines.

[advertisement] Axosoft OnTime 2008 is four developer tools in one: bug tracking, project wiki, feature management, and help desk. It manages your development process so developers can focus on coding. Installed or Hosted – Free Single-user license -- Free 30-day team trial.

No Comments : 11.18.05

Feedbacks

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment