ASP, like many other server-side scripting languages, has the ability to help you implement code that can redirect a user to another web page. The most common technique for redirecting users is using the
However, you should be aware of the implications of using the
Response.Redirect method vs other methods which may be more appropriate for situations that deal with sending users to different pages.
<% Response.Redirect("default.asp") %>
HTTP 302 Status
An ASP page that contains the
Response.Redirect method and is executed by the web server will stop processing the rest of the code on the page and returns a “302 Object Moved” back to the client browser within the header.
While the result of sending the user to the new page was achieved, it may not be the most optimal method when considering all of your visitors, including web spiders.
For example, if you set up a new domain name and you decided to use the
Response.Redirect method on your old pages to redirect your users to the new site, the result of using this technique would work because it will get your visitor to the new location.
However, this technique for human visitors may work, it is not the best method for informing web spiders that you have moved to a new domain name.
<% Response.Redirect("http://www.new-domain.com") %>
HTTP 301 Status
Rather than using the
Response.Redirect method, it would be preferable to send back the appropriate headers, not only to redirect the visitor to the new page, but also to inform the user agent that the page has been “Moved Permanently”.
<% Response.Status="301 Moved Permanently" Response.AddHeader "Location", "http://www.new-domain.com" %>
301 redirect is the most Search Engine (SEO) Friendly method for web page redirection. The main advantage is that using this technique will preserve your search engine rankings for that particular page. Search engines will update their databases accordingly to the new information gathered from the