1

I tried to do a permanent redirect in the Global.asa file in my Classic ASP application by adding this code:

Sub Session_OnStart
  queryString= Request.ServerVariables("QUERY_STRING")
  url = "http://www.newdomain.com" & Request.ServerVariables("PATH_INFO")
  If Len(queryString)<>0 Then
    url = url & "?" & queryString
  End If

  Response.Status = "301 Moved Permanently"
  Response.AddHeader "Location", url
  Response.End()
End Sub

This works great the first time for one user because it's doing the redirect once per Session, but how can I do it on every request?

user692942
  • 16,398
  • 7
  • 76
  • 175
Iosif Petre
  • 188
  • 3
  • 8

1 Answers1

1

Add Session.Abandon to your sub, before the redirect. This will end the session and any new requests will start a new session.

johna
  • 10,540
  • 14
  • 47
  • 72