Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

HTTP_REFERER

Posted on 2007-03-29
10
Medium Priority
?
474 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 200 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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/…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

704 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