Microsoft ASP.NET and 301 Redirects
I wrote a post about some roadblocks to SEO when using Microsoft .Net a few weeks ago so this is just an addendum of sorts.
Anybody who has programmed in Visual Studio quickly gets addicted to Intellisense. It makes life easy…for programmers. But for anyone wanting to say, 301 redirect, it totally throws a monkey wrench into the deal.
When creating a “Response.Redirect” in Asp.Net, understand that the innate behavior is the creation of a 302 redirect. Extra steps have to be taken to get a desired 301. So, instead of simply writing
Response.Redirect(“http://www.newLocation.com”);
Do the following:
Response.StatusCode = 301;
Response.Status = “301 Moved Permanently”;
Response.RedirectLocation = “http://www.newLocation.com”;
Response.End();
Yes, that’s 4 lines of code instead of one. But that’s the way Microsoft rolls. The easy way is not always the best way.
Sphere It