Get URL and Previous URL

I am trying to get the user URL and previous URL.
I'm using server varialble

HOST, URL and Referer,  I'm able to get the host and url but can't get the previous page, HTTP_REFERER.

Am I doing something worng why can't I?

<%
Host = Request.ServerVariables("HTTP_HOST")
Url = Request.ServerVariables("URL")
PrevSite = Request.ServerVariables("HTTP_REFERER")
%>

Thanks
swtlbeeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ainapureConnect With a Mentor Commented:
say your above lines of code is in a page on ur website called http://mysite/test.asp then for testing what u need to do is first visit some other site and in the same browser then go to your test page, I hope you didnt test the code by launching the new browser window and executing your page because then prevsite will be emtpy.

-amit
0
 
ainapureCommented:
there is just a spelling mistake in ur code. Use the following line

PrevSite=Request.ServerVariables("HTTP_REFFERRER")


Hope this helps
-amit
0
 
swtlbeeAuthor Commented:
Ok, change the spelling but I still get PrevSite=""

<%
PrevSite= Request.ServerVariables("HTTP_REFFERRER")
%>
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
fritz_the_blankCommented:
Request.ServerVariables("HTTP_REFFERRER") will only give you a value if someone arrived at that page via a hyperlink. Otherwise, you will get an empty string.

FtB
0
 
fritz_the_blankCommented:
To see all values, try:

for objItem in Request.ServerVariables
  response.write(objItem & ": " & request.servervariables(objItem) & "<br>")
next

FtB
0
 
GaryCommented:
But spelling it right (well wrong but blame MS) will help - REFERRER
0
 
fritz_the_blankCommented:
as opposed reeferer ;->


FtB
0
 
Göran AnderssonCommented:
Copy-paste from MSDN... The correct spelling is:
HTTP_REFERER
0
 
GaryCommented:
reeferer ?? (Have you been smoking something Fritz)
0
 
fritz_the_blankCommented:
Uhmmm....No?    ;->

FtB
0
All Courses

From novice to tech pro — start learning today.