2

I have looked through all the asp redirects and they all say the same thing. I'm trying to redirect single .asp pages to new url. Here is the code I keep seeing and have tried placing at the beginning of the pages in question multiple times:

<%@Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader ( "Location","http://www.new-location.com" )
%>

It does not seem to work. It looks like typical .asp page swith the <@ Language=VBScript %> at the top followed by html code. Is there another way to redirect single .asp pages?

Doozer Blake
  • 7,677
  • 2
  • 29
  • 40

3 Answers3

8

I think that the parentheses are the trouble here

<%@Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.new-location.com"
%>
Doozer Blake
  • 7,677
  • 2
  • 29
  • 40
Eduardo Molteni
  • 38,786
  • 23
  • 141
  • 206
  • 1
    +1. It seems like there's `On Error Resume Next` in somewhere above. Otherwise, should an error occur because of the parentheses. – Kul-Tigin Oct 25 '11 at 23:06
1

I know I am very late, but if you have HTML following the redirect you will need to use Response.End():

<%@ language="VBScript" %>
<% 
Response.Status="301 Moved Permanently" 
Response.AddHeader ( "Location","http://www.new-location.com" ) 
Response.End()
%> 
1

Try this...

<%@ language="VBScript" %>
<% 
Response.Status="301 Moved Permanently" 
Response.AddHeader ( "Location","http://www.new-location.com" ) 
%>