Solved

referrer information in IIS

Posted on 1998-11-03
6
1,193 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
Independent Software Vendors: 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 100 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS: How do I override in-line styling 11 32
hbo knew my windows software 4 76
Help in good tutorials for PHP, HTML and CSS 6 54
Level out logo and increase size? 16 29
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
This video teaches users how to migrate an existing Wordpress website to a new domain.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

696 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