Solved

HTTP_REFERER

Posted on 2007-03-29
10
468 Views
Last Modified: 2012-03-15
I want to log the Request.ServerVariables("HTTP_REFERER") when the 1st time a user enters any page on my root domain.  They could enter the site from say a search engine and land on page 2 of my site.  Then they may go to page 3 from there.  When the user land on page 2 I want to log the other dmain address they came from.  How do I do this?
0
Comment
Question by:jeffreytp
[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
10 Comments
 
LVL 22

Expert Comment

by:WMIF
ID: 18818088
you can do this a couple ways.  it depends on your server and if you have access to a file called global.asa.  if you dont have access, its real easy to just track this with a session variable.  make a file that you would include on all of your pages.  this will check for a session variable and record your referer value if that session variable doesnt exist.  if it does, just go back to the first page.

include file:
<%
if not session("gotrefer") = "true" then
  'log http_referer
end if
%>

all other files:
<!--#include file="aboveinclude.asp"-->
<%
'other asp code...
0
 
LVL 22

Expert Comment

by:WMIF
ID: 18818093
oops, forgot one line:


include file:
<%
if not session("gotrefer") = "true" then
  'log http_referer
  session("gotrefer") = "true"
end if
%>

all other files:
<!--#include file="aboveinclude.asp"-->
<%
'other asp code...
0
 

Author Comment

by:jeffreytp
ID: 18818273
Thank you for your input WMIF  I played around with the asp code you provided and this is the code that does what I intended it to do, maybe you didn't quite understand what I was saying:

if not session("referer") > "" then
  'log http_referer
  session("referer") = Request.ServerVariables("HTTP_REFERER")
end if
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 22

Expert Comment

by:WMIF
ID: 18818413
that will definately store the referer information into a session variable, but i figured that you wanted to store this information into a database or file of somesort.  that is what i intended to replace the comment "log http_referer".  sorry i did not explain that better.  do you only want to store this into a session variable?
0
 

Author Comment

by:jeffreytp
ID: 18818434
for now, and then I can take the session and place that into a DB.
0
 
LVL 22

Accepted Solution

by:
WMIF earned 50 total points
ID: 18819435
i would place the code in the include file to store the value into the db.
0
 
LVL 14

Expert Comment

by:B_Dorsey
ID: 18821041
Just a heads up "Request.ServerVariables("HTTP_REFERER")" is not reliable as most antivirus packages like NORTON block it from showing up
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Server Timeout with Loop 6 63
Issues with Insert statement 12 31
Clear input text 15 34
Pass SQL to JSON. Page is in classic ASP and using Jquery 4 58
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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 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