What is wrong with Request.ServerVariables("HTTP_REFERER")?
The situations where this servervariable works include the following methods of a browser loading a URL:
A straight HTML <a href>
A form submit (POST or GET) using a submit button or <input type=image>
The situations where it doesn't work:
A link from Favorites
A click on 'Home' or a Link with a defined URL
A page linked from HierMenus (details)
Typing the URL directly in the browser
Launching a clickable URL from an e-mail or Word document
Using Response.Redirect / Server.Transfer
Using Response.AddHeader or <meta http-equiv=refresh> to redirect
Loading the URL with XML (see Article #2173)
Obviously, this variable cannot be relied upon for many situations.