Solved

referrer information in IIS

Posted on 1998-11-03
6
1,202 Views
Last Modified: 2013-12-25
Does anyone know how to get the referrer information using asp and IIS?
0
Comment
Question by:1stomni
[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
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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
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 WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

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. …
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

688 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