Request.ServerVariables("HTTP_REFERER") contains nothing; why?

  • Thread starter Thread starter Jake
  • Start date Start date
J

Jake

I need to know whether a request for a resource on our web server is coming
from a particular affiliate domain or from another domain. In my testing,
the HTTP_REFERER variable sometimes is empty. Under what circumstances can
it be empty? Is there any way to know the origin of a request, for certain?
Thanks
Jake
 
Hi,

HTTP_REFERER will be empty if the user visited the site without clicking a
link. Also, it is possible that the agent is not sending the referer. Some
security software will prvent a browser from sending this.

The only reliable way to do what you want is to have affliates use a code
sent on the querystring - e.g.
www.yoursite.com/index.aspx?affiliatecode=123456. You could then either do
something with this code in your ASPX page (Like log to a DB) or analyse
your log files. The latter would require that you manually link the
affiliate code to the actual person/company, where as logging to a DB etc
could allow alot more scope, for example you could automatically reward the
affliate when the referer code got to a given value.

Hope that helps!
Simon.
 
Thanks, Simon. I had hoped there was a way that wouldn't require our
affiliates to have to change anything on their end. But if not, not. I've
heard of people limiting traffic to a certain IP address. For example, a web
service that will only accept requests for a specific IP. Are they doing
this perhaps with a firewall, and not with any feature of ASP.NET?
Regards
Jake
 
Jake said:
Thanks, Simon. I had hoped there was a way that wouldn't require our
affiliates to have to change anything on their end. But if not, not. I've
heard of people limiting traffic to a certain IP address. For example, a
web
service that will only accept requests for a specific IP. Are they doing
this perhaps with a firewall, and not with any feature of ASP.NET?

No probs :)

Sorry - I think you're going to have to get your existing affilites to
change there links.

I don't see how limiting traffic to given IP addreses would help - Perhaps
I'm missing something?

Simon.
 
I need to know whether a request for a resource on our web server is
coming
from a particular affiliate domain or from another domain. In my testing,
the HTTP_REFERER variable sometimes is empty. Under what circumstances
can
it be empty? Is there any way to know the origin of a request, for
certain?
Thanks
Jake

Just to add, browsers like Opera can also do this; I usually have mine
turned off. This way of detecting where a user is coming from has never
been reliable...
 
Back
Top