In web traffic analysis, it's helpful to find out how users found your site, especially if the user came from a link on another page. A reader asked how to get this information, and it's really easy to do. In the page headers, there is an HTTP variable called HTTP_REFERER which contains the URL that a user hit immediately before coming to your site. You can access this information through the ServerVariables collection, as shown in this example:
<a href="<% = Request.ServerVariables("HTTP_REFERER")%>">Go back to where you came from</a>
If you have another page linking to this one, the HTTP_REFERER variable will show that as the previous page. Unfortunately, this method is not always reliable. In my own testing, putting this code on a page and then typing in its URL caused the variable to be blank.
If you need a better way to track user movement through your site, you can add a URL parameter or session variable indicating the page you're on. In page #1, you set the value to some constant or code. In page #2, you first record the current value of the variable, and then change the value to refer to the current page. As you work through the site, you'll have a "linked list" of how the user navigated the site.