Article posted by Abhi2434
on 3/1/2010 | Views: 6067 | Category: ASP.NET
| Level: Beginner
The article discusses one of the new feature introduced with .NET 4.0 which enable you to Redirect your page for Search Engine
.NET 4.0 introduces a new concept to redirect your page from one location to another. From the early days, you have been using Response.Redirect / Server.Transfer. While Server.Transfer doesnt seem to send any information about redirection to search engine, Response.Redirect redirects a page and sends 302 as its response Code. The response code 302 identifies that the transfer is a temporary and therefore, the Search Engine entry will never be updated. But in certain cases when you require the search page to redirect it permanently. You might want the search result to show the new page rather than the old page which redirects to the new page. Here lies the requirement of this new method Response.RedirectParmanent.
Main Objective of Response.RedirectParmanent
Response.RedirectParmanent works in similar fashion as to Response.Redirect. The only difference is its Response code.
Method Response Code Meaning
Redirect() 302 Response is Redirected temporarily and Search Engine Doesn't need to change its entry
RedirectParmanent() 301 Redirect is parmanent, and Search engine will update the old entry with the new one.
Server.Transfer() 200 No redirection code is sent, and Search Engine will think the response is coming from the same page.
From the above table, it is clear that Search engine will only update its entry when we use RedirectParmanent.
You must know that this method is introduced in ASP.NET 4.0, so if you are in previous version, you can use :
public static class Extensions
public static void RedirectPermanent(this HttpResponse Response,
Response.Status = "301";
Response.RedirectLocation = absoluteUri;
This Extension will add the RedirectParmanent to your application.
Response.Redirect is perfect when your page is temporarily changed and will again be reverted to original within a short span of time.
Response.RedirectParmanent() when you are thinking of deleting the original page totally after the search engines changes its database.
Server.Transfer() when you are thinking of keeping the page for ever, and to let search engine unaware of this redirection.
To Conclude, I must be thankful that the method is added permanently to the Framework. Hence, I dont need to write my own extension. Use it gracefully and only when it is required. There are lots of other features as well, I hope I would try to discuss each of them in my next series of articles.
Thanks for Reading.
If you like this article, subscribe to our RSS Feed. You can also subscribe via email to our Interview Questions, Codes and Forums section.
Found interesting? Add this to: