javascriptasp-classic

How can I get the previous page from history in classic ASP?


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.


Solution

  • 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.