Monday, August 27, 2007

.NET 301 Redirect

{

Scott Hanselman was noting that many people who'd updated the locations of their tools on his 2007 Ultimate Developers Tools List had emailed or contacted him asking him to update his reference.

He lamented the fact that they didn't simply use HTTP 301 redirects (Moved Permanently) which tools can easily use to update referenced links.

I must confess, I was one of those people.  I just lazily made a default.asp that had one line:

Response.Redirect("http://www.nregex.com")

But 301 redirect are pretty simple whether you use .NET or lazily throw an ASP script somewhere.

'classic ASP
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://foo/bar.asp"

'.NET

Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://foo/bar.asp");

Source: seoconsultants.

}

1 comment:

yogesh.narayanan said...

Good one really was very helpful to freshers like me

Also i use 301 redirect checker to confirm the same.