Solved

HTTP_REFERER

Posted on 2007-03-29
10
459 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
  • 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

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…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now