(866) 837-0540
 
 

Internet Marketing and Design Services for Turnkey Web Solutions 

Facebook Twitter Gplus Flickr LinkedIn YouTube Google Maps E-mail RSS
 
 
Home » web development » web design » ASP » Classic ASP header redirect (302 Object Moved)
formats

Classic ASP header redirect (302 Object Moved)

Published on August 19th, 2008 by in ASP

ASP makes it easy to redirect a user to another page. This is a
useful trick for redirecting users after form submissions, protecting
content on your site by redirecting users to a login page, and pointing
an old page address to a new one.

Classic ASP header redirect (302 Object Moved)

At the top of your ASP document (before any HTML code), use the following code:

<% Response.Redirect("default.asp") %>

This example shows how to redirect a user to a page on your own
site, in the same directory as your redirect page. If you wanted to
redirect a user to a completely different website, simply use the full
URL:

<% Response.Redirect("http://www.yourdomain.com") %>

The Response.Redirect declarative gives an “Object Moved,” or Status
Code 302 header response. If you want to permanently point an old page
address to a new one using ASP, see below.

Serving a permanent redirect (301) header status code

There may be an instance where you want to point an old page to a
new location. This can be accomplished in ASP by including specific
header information in your code snippet. The following example serves a
301 Redirect (“301 Moved Permanently”) to anyone who accesses the page.

<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, “http://www.thenewdomain.com”
%>

VN:F [1.9.13_1145]
Rating: 8.9/10 (10 votes cast)
VN:F [1.9.13_1145]
Rating: +1 (from 1 vote)
Classic ASP header redirect (302 Object Moved) , 8.9 out of 10 based on 10 ratings
 
Take a piece of the Web from WebPaws.com: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Facebook
  • LinkedIn
  • TwitThis
  • MySpace
  • Google Bookmarks
  • Webnews
  • Digg
  • del.icio.us
  • StumbleUpon
  • eKudos
  • email
  • Fleck
  • Hype
  • MisterWong
  • Print
  • Technorati
  • YahooMyWeb
 
Tags: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© Copyright © 1998-2011, WebPaws.com All rights reserved.
credit