Published on

Status code 301 “moved permanently” in ASP.Net

Authors
  • avatar
    Name
    Mike Barram
    Twitter
Response.StatusCode = 301
Response.Redirect("http:////www.NewLocation.com")
'''
doesn’t result in a status code of 301, so do it this way:  
```C#
Response.Status = "301 Moved Permanently";  
Response.AddHeader("Location","http:////www.NewLocation.com");  
Response.End();

thanks to:
http://www.vikramlakhotia.com/Search\_Engine\_Web\_World\_and\_301\_redirect.aspx

In ASP.Net 4 you can use Response.RedirectPermanent()

In ASP the code would be:

<%@ Language=VBScript %>  
<%  
Response.Clear  
Response.Status=”301 Moved Permanently”  
Response.AddHeader “Location”,”http://www.address\_to\_redirect\_to/”  
%>