http_referer different than document.referrer - why?

  • Thread starter Thread starter Mike Dee
  • Start date Start date
M

Mike Dee

Hi All - I'm having a strange problem I'm wondering if anyone can shed some
light on.

When I use ASP or ASP.NET code to get the referrer information from the
server side, it comes back as null. However in these same cases
document.referrer returns the valid referrer. What could cause this?

In other words, with the following line:
ref = Request.ServerVariables("HTTP_REFERER") (or its ASP.NET equivalent)

ref is set to ""

However if in the same page I add this code:

<script>
alert("ref: " + document.referrer);
</script>

Then I get a JS alert showing the corrct referrer value. I've also tried
using "HTTP_REFERRER" (two Rs) and it doesn't make a difference.

So why would the client side approach return the correct value at a time
when the server-side approch does not?

Thanks in advance for any thoughts or ideas you have on this! It is driving
me nuts.

--- Mike
 
many proxy servers strip the referer header, also the browser may be set to
not send it.

-- bruce (sqlwork.com)
 

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

Back
Top