?
Solved

referrer information in IIS

Posted on 1998-11-03
6
Medium Priority
?
1,215 Views
Last Modified: 2013-12-25
Does anyone know how to get the referrer information using asp and IIS?
0
Comment
Question by:1stomni
6 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 1856075
<%
Response.write Request.ServerVariables("HTTP_REFERER")
%>

0
 

Author Comment

by:1stomni
ID: 1856076
We have tried this already.  We printed all of the server variables and referer does not show up.  Do we need to set something in IIS to get this information.  Also, what browsers support this?
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1856077
The Referer works in IE and NS for sure.  I have tested in IE 3.x and up and NS 3.x and up.  Also, to use the referer, you must be coming from a site.  You cannot just type in an address.  Also, make sure you spelled it correctly.  It is with one "r" not two.


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1856078
MasseyM: IE 3.01 and lower does as far as I know not pass the referrer.

In most browsers the referrer is not set when the page with the link is loaded from harddisk or from the location bar. NS 2.0 also passes the referrer.

Michel
0
 
LVL 28

Accepted Solution

by:
sybe earned 200 total points
ID: 1856079
HTTP_REFERER is independent of the browser, it is part of the http-protocol.
MasseyM is right to tell you must come from a site to see it. If there is no referer, the value of HTTP_REFERER is empty.
But it exists nonetheless, as you can see in this ASP-code:

<TABLE BORDER=1 WIDTH=100%>
<TR>
  <TH COLSPAN=2> HTTP / Server Variables</TH>
</TR>
<TR>
  <TD><B>Server Variable</B></TD>
  <TD><B>Value</B></TD>
</TR>
  <% For Each name In Request.ServerVariables %>
<TR>
  <TD> <%= name %> </TD>
  <TD> <%= Request.ServerVariables(name) %> </TD>
</TR>
<% Next %>
</TABLE>




The referer that Michel talks about is the value of the referer in the client (which can be called with javascript). IE3 has a bug in the document.referrer (javascript uses double "r"), which gives it the same value as document.location. In fact you can recognize IE3 by this:

<script>
if (document.referrer == document.location) {
  alert("this browser is MSIE3");
}
</script>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1856080
Sybe: I might have mixed it up with the stats sites that cannot do referer stats on IE3

I thought the browser did not send it (it IS http client dependant however)

It must be because they use JavaScript to send the referer along to the stats program... now why couldn't they just use the http-referer if what you say is true?

Michel
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

840 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