Solved

Get URL and Previous URL

Posted on 2003-11-10
10
1,146 Views
Last Modified: 2007-12-19
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
0
Comment
Question by:swtlbee
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 4

Expert Comment

by:ainapure
ID: 9717472
there is just a spelling mistake in ur code. Use the following line

PrevSite=Request.ServerVariables("HTTP_REFFERRER")


Hope this helps
-amit
0
 

Author Comment

by:swtlbee
ID: 9717607
Ok, change the spelling but I still get PrevSite=""

<%
PrevSite= Request.ServerVariables("HTTP_REFFERRER")
%>
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9717617
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9717624
To see all values, try:

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

FtB
0
 
LVL 4

Accepted Solution

by:
ainapure earned 125 total points
ID: 9717635
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
 
LVL 58

Expert Comment

by:Gary
ID: 9717972
But spelling it right (well wrong but blame MS) will help - REFERRER
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9718014
as opposed reeferer ;->


FtB
0
 
LVL 29

Expert Comment

by:Göran Andersson
ID: 9718288
Copy-paste from MSDN... The correct spelling is:
HTTP_REFERER
0
 
LVL 58

Expert Comment

by:Gary
ID: 9718402
reeferer ?? (Have you been smoking something Fritz)
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9718445
Uhmmm....No?    ;->

FtB
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question