Geeks With Blogs
Rajesh Pillai My experiments with asp.net mvc, jquery, wpf, silverlight, sharepoint, tdd and design patterns.

ASP.NET 4 Permanently Redirecting a page

You may have faced this problem of moving pages in a web applications around which can leat to an
accumulation of state links in search engines.  Traditionally developers have handled requests to old URL's by using
Response.Redirect method to forward request to new URL. 

However as you may be aware of the Redirect method issues an HTTP 302 Found status (temporary redirect) response
, which results in an extra HTTP round trip to the server when users attempt to access the old URL's.  This has a performance
implication as well because of the round trip.

ASP.NET 4 adds a new RedirectPermannent helper method which makes it easy to issue HTTP 301 Moved Permanently
responses.

RedirectPermanent("/newlocation/oldcontent.aspx")

With this addition the search engines and other user agents that recognizse permanent redirects will store the new URL
that is associated with the content, which eliminates the unnecessary round trip made by the browser for temporary redirects.

You can verify this by observing the request in the Fiddler.  For me I think this feature is pretty useful in migrating application
from old website to the new one.  Will definitely save a lot of headache.
 

Posted on Saturday, November 28, 2009 3:16 PM ASP.NET 4.0 , .NET 4 | Back to top


Comments on this post: Tip: ASP.NET 4 Permanently Redirecting a page

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Rajesh Pillai | Powered by: GeeksWithBlogs.net