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

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
 
S

Simon Harris

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.
 
J

Jake

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
 
S

Simon Harris

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.
 
C

Craig Deelsnyder

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top