469,903 Members | 1,918 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

http_referer different than document.referrer - why?

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

Dec 6 '05 #1
1 2585
many proxy servers strip the referer header, also the browser may be set to
not send it.

-- bruce (sqlwork.com)
"Mike Dee" <x@x.com> wrote in message
news:7K********************@comcast.com...
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

Dec 6 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Brett | last post: by
2 posts views Thread by John | last post: by
5 posts views Thread by Nospam | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.