views:

152

answers:

2

Is there a way I can get the previous page the user was at in classic ASP? I am looking for the equivalent of history.go(-1) in JavaScript.

+3  A: 

Depending upon your needs you may be able to use:

Request.ServerVariables("HTTP_REFERER");

Returns a string containing the URL of the page that referred the request to the current page using an <a> tag. If the page is redirected, HTTP_REFERER is empty.

Typically if I need to know where the user came from, though, I would set this explicitly in the querystring or in a form variable.

RedFilter
+1, this is not a guaranteed value.
jvenema
+1  A: 

http://www.w3schools.com/asp/coll_servervariables.asp

Request.ServerVariables ( "HTTP_REFERER" )

JDMX