473,499 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2750
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
14015
by: JW | last post by:
I use Request.ServerVariables("HTTP_REFERER") to get the URL of the referrer page. However, if the page that has Request.ServerVariables("HTTP_REFERER") is in a popup window then the value is...
1
2550
by: JW | last post by:
Sorry, posting this twice as it tagged on to a spetember posting: --------------------------------------------------------------- I use Request.ServerVariables("HTTP_REFERER") to get the URL of...
4
1692
by: Brett | last post by:
rf=Request.ServerVariables("HTTP_REFERER") sv2=Request.ServerVariables("URL") & "?" & Request.ServerVariables("QUERY_STRING") if instr(rf,"http://www.westcoast") = 1 then 'response.redirect...
9
3899
by: Robert Mark Bram | last post by:
Hi All! I have the following in an ASP script: var bounceBackPage = Request.ServerVariables("HTTP_REFERER"); Response.Write("<p>bounceBackPage: " + bounceBackPage + ". Undefined? " +...
8
5076
by: | last post by:
Can one reliably use http_referer to track a user page selections as I appear to be getting BLANK values? I have read that company firewalls etc block this method.... Thanks jason
28
4852
by: Prabhat | last post by:
Hello, I have the below requirement. When ever my website is opened by any link: say clicked from the google search result or a link from other website: Then I should able to know the...
2
1980
by: John | last post by:
Hi I am trying to save the value of HTTP_REFERER so I can use it later on in the webform as below; Public Return_Address as string Private Sub Page_Load(ByVal sender As System.Object,...
15
15381
by: Drebin | last post by:
I am retrofitting a central login application and want to be able to read the Request.ServerVariables so that when they have logged on, I can send them back to wherever they were trying to go.. ...
5
10991
by: Nospam | last post by:
does anyone know if there is anything wrong with this code? <SCRIPT LANGUAGE="JavaScript">document.referrer.indexOf("http://www.example.com") != -1){ ...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7225
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7392
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5479
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4920
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3105
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3101
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
307
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.