DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

ASP.NET Permanent Redirect (301)

07.23.2008
| 4262 views |
  • submit to reddit
        Response.Redirect normally returns a 302 Object moved HTTP response. However a 301 permanent redirect is often better for search engine spiders:

Response.StatusCode = 301;
Response.AddHeader("Location", "New.aspx");
Response.Write("<html><body>Page moved permanently to <a href="New.aspx">New</a></body></html>");
Response.End();