x

Permanently Redirecting a Page in Asp.Net

Sunday, June 24, 20120 comments


In this article we will discuss how to permanently redirect a page to different address in Asp.Net. Also you can check how to redirect from domain.com to www.domain.com. asp.net. You can also check Web.config and Machine.config asp.net.

In Asp.Net we can redirect one page to another page useing Response.Redirect. But the Redirect method issues an HTTP 302 Found (temporary redirect) response, which results in an extra HTTP round trip when users attempt to access the old URLs.
But in Asp.Net 4, ASP.NET 4 adds a new RedirectPermanent helper method that makes it easy to issue HTTP 301 Moved Permanently responses, as in the following example:
RedirectPermanent("/newpath/foroldcontent.aspx");

Benifits:
Search engines and other user agents that recognize 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.
Share this article :

Post a Comment

 
Copyright © 2010. SharePointDotNet.com - All Rights Reserved
Template Created by Creating Website Published by Mas Template