10.8. Response.RedirectPermanent()

Response.Redirect() is a frequently used method that redirects the current request to another URL. At an HTTP level, Response.Redirect() issues a temporary redirect (HTTP 302) message to the user's browser. ASP.NET 4.0 now offers a new Response.RedirectPermanent() method that issues a permanently moved (HTTP 301) message (www.w3.org/Protocols/rfc2616/rfc2616-sec10.html).

Why bother? HTTP 301 is mainly used to tell search engines that they should save the new page location in their indexes rather than the old location. This saves an unnecessary trip to the server. Response.RedirectPermanent() usage is very similar to Response.Redirect():

Response.RedirectPermanent("/newpath/foroldcontent.aspx");

Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.