Solved

Get URL and Previous URL

Posted on 2003-11-10
10
1,152 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 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