getting Reffering site info

T

TdarTdar

Hello,
I want to get reffering site info like if the way they got to the site is
from google, While that is easy enough, of course, but I want to get that
info after they have been on the site for a while, I was thinking that I
could get the reffer in the session_onstart event, and make it a session var
but that did not work, So I am looking for thoughts about this.

Tdar
 
E

Evertjan.

=?Utf-8?B?VGRhclRkYXI=?= wrote on 23 jul 2007 in
microsoft.public.inetserver.asp.general:
Hello,
I want to get reffering site info like if the way they got to the
site is
from google, While that is easy enough, of course, but I want to get
that info after they have been on the site for a while, I was thinking
that I could get the reffer in the session_onstart event, and make it
a session var but that did not work, So I am looking for thoughts
about this.

Referrer = Request.ServerVariables("HTTP_REFERER")

Why would you want he result in a session variable,
as the above is available all through the session?
 
T

TdarTdar

So HTTP_REFERER is only populated from the start and when they run thru
other pages of our site it aways stays the same data as the first time they
accesed the site?
 
E

Evertjan.

=?Utf-8?B?VGRhclRkYXI=?= wrote on 23 jul 2007 in
microsoft.public.inetserver.asp.general:

[Please do not toppost on usenet]
So HTTP_REFERER is only populated from the start and when they run
thru other pages of our site it aways stays the same data as the first
time they accesed the site?

You are right, my mistake.
 
T

TdarTdar

So I still need a solve for this, :(

If it was possiable to get ServerVariables("HTTP_REFERER")
when the session is first opened, I should try a asp.net handler?
and get it before the page is write is that even possiable?





Evertjan. said:
=?Utf-8?B?VGRhclRkYXI=?= wrote on 23 jul 2007 in
microsoft.public.inetserver.asp.general:

[Please do not toppost on usenet]
So HTTP_REFERER is only populated from the start and when they run
thru other pages of our site it aways stays the same data as the first
time they accesed the site?

You are right, my mistake.
 
E

Evertjan.

=?Utf-8?B?VGRhclRkYXI=?= wrote on 23 jul 2007 in
microsoft.public.inetserver.asp.general:
So I still need a solve for this, :(

If it was possiable to get ServerVariables("HTTP_REFERER")
when the session is first opened, I should try a asp.net handler?
and get it before the page is write is that even possiable?

Sorry, I do not like topposting.

Evertjan. said:
=?Utf-8?B?VGRhclRkYXI=?= wrote on 23 jul 2007 in
microsoft.public.inetserver.asp.general:
:

=?Utf-8?B?VGRhclRkYXI=?= wrote on 23 jul 2007 in
microsoft.public.inetserver.asp.general:

Hello,
I want to get reffering site info like if the way they got to
the site is
from google, While that is easy enough, of course, but I want to
get that info after they have been on the site for a while, I
was thinking that I could get the reffer in the session_onstart
event, and make it a session var but that did not work, So I am
looking for thoughts about this.

Referrer = Request.ServerVariables("HTTP_REFERER")

Why would you want he result in a session variable,
as the above is available all through the session?

[Please do not toppost on usenet]
So HTTP_REFERER is only populated from the start and when they run
thru other pages of our site it aways stays the same data as the
first time they accesed the site?

You are right, my mistake.
 
B

Bob Barrows [MVP]

TdarTdar said:
Hello,
I want to get reffering site info like if the way they got to the
site is from google, While that is easy enough, of course, but I want
to get that info after they have been on the site for a while, I was
thinking that I could get the reffer in the session_onstart event,
and make it a session var but that did not work, So I am looking for
thoughts about this.
Start by showing us the code you attempted to use and then move on to
telling us what "did not work" means.
 
T

TdarTdar

in global.asa and in global.asax

Sub Session_OnStart
Session("WhereFrom") = Request.ServerVariables("HTTP_REFERER")
End Sub


When I run a test to see if it worked I get nothing
EX:
<body>
<%=Session("WhereFrom")%>
</body>
 
B

Bob Barrows [MVP]

TdarTdar said:
in global.asa and in global.asax

Sub Session_OnStart
Session("WhereFrom") = Request.ServerVariables("HTTP_REFERER")
End Sub


When I run a test to see if it worked I get nothing
EX:
<body>
<%=Session("WhereFrom")%>
</body>
I see. yes, the code to assign the value for Session("WhereFrom") has to be
in a .asp page, not in global.asa. HTTP_REFERER will be empty in global.asa
 
T

TdarTdar

Hi,
I was thinking the same thing untill i saw this article
http://msdn2.microsoft.com/en-us/library/ms953184.aspx
and this code from it

Sub Session_onStart()
On Error Resume Next
strSQL = "INSERT INTO Sessions " _
&
"(EventType,URL,Referer,RemoteHost,UserAgent,UALanguage,UserID,HostIP)" _
& " VALUES ('New Session', '" _
& Request.ServerVariables("URL") & "', '" _
& Request.ServerVariables("HTTP_REFERER") & "', '" _
& Request.ServerVariables("REMOTE_HOST") & "', '" _
& Request.ServerVariables("HTTP_USER_AGENT") & "', '" _
& Request.ServerVariables("HTTP_ACCEPT_LANGUAGE") & "', " _
& CLng(Session.SessionID) & ", '" _
& Request.ServerVariables("LOCAL_ADDR") & "')"
WriteSessionData(strSQL)
End Sub

So I thought maybe that it was due to having the same session names in
global.asa as global.asax and that was not the case I still get nothing, of
course I can
get the http_REFERER. The article does say it if is not an asp page then it
will not work on htm pages, and the page is an asp page.

So I am kinda stumped why microsoft says it is possiable in there one article
 
A

Anthony Jones

Bob Barrows said:
I see. yes, the code to assign the value for Session("WhereFrom") has to be
in a .asp page, not in global.asa. HTTP_REFERER will be empty in
global.asa

I haven't tested it yet but I can't see why that should be so.
Session_OnStart does occur in the context of a HTTP request and all that a
ServerVariables("HTTP_XXXXX") does is access the request header called
XXXXX. ASP would have to go out of its way to block access to the Referer
for some reason for it not be able to read this header.
 
B

Bob Barrows [MVP]

Anthony said:
I haven't tested it yet but I can't see why that should be so.
Session_OnStart does occur in the context of a HTTP request and all
that a ServerVariables("HTTP_XXXXX") does is access the request
header called XXXXX. ASP would have to go out of its way to block
access to the Referer for some reason for it not be able to read this
header.

Now that i think about it, I'm not sure what I was thinking of. It would
still help to test it to verify it, but I can find nothing to say the
ServerVariables aren't available in global.asa.
 
T

TdarTdar

Anthony,
I have done a check but not with www.fiddlertool.com I do get a http_***
stuff in the browser when I test and loop thru them all from the page.
...

I may have a support incident avaiable so I guess I am going to have to go
that route.
 
A

Anthony Jones

TdarTdar said:
Anthony,
I have done a check but not with www.fiddlertool.com I do get a http_***
stuff in the browser when I test and loop thru them all from the page.
..

Do you get HTTP_REFERER header in your test? You are navigating to it from
another page that is outside your app? If you enter the URL in the address
bar or using a link from favorites or some such you're not going to get a
referer.
 
T

TdarTdar

ok I got is solve before i had to talk to microsoft,

if starting page is .asp then global.asa on start gets set

if starting page is .aspx then global.asax is used

session vars are nottransforable between the two without additional coding
and there is an acticle from microsoft on that
http://msdn2.microsoft.com/en-US/library/aa479313.aspx .

and you are out of luck with htm or html
 
A

Anthony Jones

TdarTdar said:
ok I got is solve before i had to talk to microsoft,

if starting page is .asp then global.asa on start gets set

if starting page is .aspx then global.asax is used

session vars are nottransforable between the two without additional coding
and there is an acticle from microsoft on that
http://msdn2.microsoft.com/en-US/library/aa479313.aspx .

and you are out of luck with htm or html

Ouch. Sorry about that I had missed you stating earlier that you had the
session start code in both global.asa and .asax.
 

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

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,233
Latest member
AlyssaCrai

Latest Threads

Top