473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Use of HTTP_REFERER in Global.asa

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 referrer URL. How Do I get that?

I know about Request.ServerVariables("HTTP_REFERER"). So I used this in
"global.asa" file in "Session_OnStart" event like this:

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

Sub Session_OnEnd
Session("ReferralURL") = ""
End Sub

So that I can use the session variable any where in my website, because the
HTTP_REFERER will give the URL of the last webpage.

But this seems to not working.

Please help.

Thanks
Prabhat
Sep 1 '05 #1
28 4849
Prabhat wrote on 01 sep 2005 in microsoft.public.inetserver.asp.general:
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 referrer URL. How Do I get that?

I know about Request.ServerVariables("HTTP_REFERER"). So I used this
in "global.asa" file in "Session_OnStart" event like this:

Sub Session_OnStart
Session("ReferralURL") = Request.ServerVariables("HTTP_REFERER")
End Sub
Seting a session variable here will not work, IMHO.
Sub Session_OnEnd
Session("ReferralURL") = ""
End Sub
Clearing a session variable here has no effect, since all session
variables die with the end of a session anyway.
So that I can use the session variable any where in my website,
because the HTTP_REFERER will give the URL of the last webpage.


No, in your case it would [but doesn't] give only the URL of referral
site when opening the session.

Better put this file as an include
<!--#include virtual ="/test/myInclude.asp"-->
on all your pages:

/test/myInclude.asp:
<%
if Session("started") = "" then
Session("ReferralURL") = Request.ServerVariables("HTTP_REFERER")
Session("started") = "yes!"
end if
%>
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 1 '05 #2
Hi Evertjan, Thanks for reply.

You mean to say if I put the Session("ReferralURL") =
Request.ServerVariables("HTTP_REFERER") in Session_OnStart it will not work.
I have also tested that and it is not working. Can you please explain why?
Because as per my knowledge the Session_OnStart event will start for each
session.

As per your suggestion I will create one .asp file with the sample code and
include the file in all pages.

Can you suggest an easy method so that I need not to modify all the pages to
include the new file?

I think your logic says that if the Session Variable "started" is empty then
only assign the Session Variable with the Referral URL else no.

But dont you think I should also crear these variables on Session_OnEnd
event? Please suggest.

Thanks
Prabhat
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
Prabhat wrote on 01 sep 2005 in microsoft.public.inetserver.asp.general:
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 referrer URL. How Do I get that?

I know about Request.ServerVariables("HTTP_REFERER"). So I used this
in "global.asa" file in "Session_OnStart" event like this:

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


Seting a session variable here will not work, IMHO.
Sub Session_OnEnd
Session("ReferralURL") = ""
End Sub


Clearing a session variable here has no effect, since all session
variables die with the end of a session anyway.
So that I can use the session variable any where in my website,
because the HTTP_REFERER will give the URL of the last webpage.


No, in your case it would [but doesn't] give only the URL of referral
site when opening the session.

Better put this file as an include
<!--#include virtual ="/test/myInclude.asp"-->
on all your pages:

/test/myInclude.asp:
<%
if Session("started") = "" then
Session("ReferralURL") = Request.ServerVariables("HTTP_REFERER")
Session("started") = "yes!"
end if
%>
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 1 '05 #3
Prabhat wrote on 01 sep 2005 in microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.net> wrote in message
Prabhat wrote on 01 sep 2005 in
> I know about Request.ServerVariables("HTTP_REFERER"). So I used
> this in "global.asa" file in "Session_OnStart" event like this:
>
> Sub Session_OnStart
> Session("ReferralURL") = Request.ServerVariables("HTTP_REFERER")
> End Sub
Seting a session variable here will not work, IMHO.
> Sub Session_OnEnd
> Session("ReferralURL") = ""
> End Sub


Clearing a session variable here has no effect, since all session
variables die with the end of a session anyway.
> So that I can use the session variable any where in my website,
> because the HTTP_REFERER will give the URL of the last webpage.


No, in your case it would [but doesn't] give only the URL of referral
site when opening the session.

Better put this file as an include
<!--#include virtual ="/test/myInclude.asp"-->
on all your pages:

/test/myInclude.asp:
<%
if Session("started") = "" then
Session("ReferralURL") = Request.ServerVariables("HTTP_REFERER")
Session("started") = "yes!"
end if
%>


[please do not toppost on usenet]
You mean to say if I put the Session("ReferralURL") =
Request.ServerVariables("HTTP_REFERER") in Session_OnStart it will not
work. I have also tested that and it is not working. Can you please
explain why? Because as per my knowledge the Session_OnStart event
will start for each session.
It is als per specification. Only certein objects are available
in global.asa, I think
As per your suggestion I will create one .asp file with the sample
code and include the file in all pages.

Can you suggest an easy method so that I need not to modify all the
pages to include the new file?
No. Unless you mean local programming in C++ or VB etc..
I think your logic says that if the Session Variable "started" is
empty then only assign the Session Variable with the Referral URL else
no.
Otherwise Session("ReferralURL") would be filled with each referring
local page.
But dont you think I should also crear these variables on
Session_OnEnd event? Please suggest.


As I said, no.

1 Session variables without sessions are deleted automaticly.

2 Session_OnEnd firing is unrelyable.

3 Sessions do not end, when the user "leaves" [sloppy defined] the site,
but only when the session times out or with commands like session.abandon
or with the server closing down/restarting.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 1 '05 #4

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
Prabhat wrote on 01 sep 2005 in microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.net> wrote in message
Prabhat wrote on 01 sep 2005 in
> I know about Request.ServerVariables("HTTP_REFERER"). So I used
> this in "global.asa" file in "Session_OnStart" event like this:
>
> Sub Session_OnStart
> Session("ReferralURL") = Request.ServerVariables("HTTP_REFERER")
> End Sub

Seting a session variable here will not work, IMHO.

> Sub Session_OnEnd
> Session("ReferralURL") = ""
> End Sub

Clearing a session variable here has no effect, since all session
variables die with the end of a session anyway.

> So that I can use the session variable any where in my website,
> because the HTTP_REFERER will give the URL of the last webpage.

No, in your case it would [but doesn't] give only the URL of referral
site when opening the session.

Better put this file as an include
<!--#include virtual ="/test/myInclude.asp"-->
on all your pages:

/test/myInclude.asp:
<%
if Session("started") = "" then
Session("ReferralURL") = Request.ServerVariables("HTTP_REFERER")
Session("started") = "yes!"
end if
%>


[please do not toppost on usenet]
You mean to say if I put the Session("ReferralURL") =
Request.ServerVariables("HTTP_REFERER") in Session_OnStart it will not
work. I have also tested that and it is not working. Can you please
explain why? Because as per my knowledge the Session_OnStart event
will start for each session.


It is als per specification. Only certein objects are available
in global.asa, I think
As per your suggestion I will create one .asp file with the sample
code and include the file in all pages.

Can you suggest an easy method so that I need not to modify all the
pages to include the new file?


No. Unless you mean local programming in C++ or VB etc..
I think your logic says that if the Session Variable "started" is
empty then only assign the Session Variable with the Referral URL else
no.


Otherwise Session("ReferralURL") would be filled with each referring
local page.
But dont you think I should also crear these variables on
Session_OnEnd event? Please suggest.


As I said, no.

1 Session variables without sessions are deleted automaticly.

2 Session_OnEnd firing is unrelyable.

3 Sessions do not end, when the user "leaves" [sloppy defined] the site,
but only when the session times out or with commands like session.abandon
or with the server closing down/restarting.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


Hi Evertjan,

Thanks for the reply. Now I understodd the concept. Thanks for the post.

Prabaht
Sep 1 '05 #5
Does anybody see what's wrong with bottom-posting here? Just curious if
it's only me that is irritated to scroll through 90 lines of re-hashed
garbage to see "thank you."

"Prabhat" <no********@hotmail.com> wrote in message
news:Om**************@TK2MSFTNGP12.phx.gbl...

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
Prabhat wrote on 01 sep 2005 in microsoft.public.inetserver.asp.general:
> "Evertjan." <ex**************@interxnl.net> wrote in message
>> Prabhat wrote on 01 sep 2005 in
.... >> > this in "global.asa" file in "Session_OnStart" event like this:
>> >
>> > Sub Session_OnStart
>> > Session("ReferralURL") = Request.ServerVariables("HTTP_REFERER")
>> > End Sub
>>
>> Seting a session variable here will not work, IMHO.
>>
>> > Sub Session_OnEnd
>> > Session("ReferralURL") = ""
>> > End Sub
>>
>> Clearing a session variable here has no effect, since all session
>> variables die with the end of a session anyway.
>>
>> > So that I can use the session variable any where in my website,
>> > because the HTTP_REFERER will give the URL of the last webpage.
>>
>> No, in your case it would [but doesn't] give only the URL of referral
>> site when opening the session.
>>
>> Better put this file as an include
>> <!--#include virtual ="/test/myInclude.asp"-->
>> on all your pages:
>>
>> /test/myInclude.asp:
>> <%
>> if Session("started") = "" then
>> Session("ReferralURL") = Request.ServerVariables("HTTP_REFERER")
>> Session("started") = "yes!"
>> end if
>> %>


[please do not toppost on usenet]
> You mean to say if I put the Session("ReferralURL") =
> Request.ServerVariables("HTTP_REFERER") in Session_OnStart it will not
> work. I have also tested that and it is not working. Can you please
> explain why? Because as per my knowledge the Session_OnStart event
> will start for each session.


It is als per specification. Only certein objects are available
in global.asa, I think
> As per your suggestion I will create one .asp file with the sample
> code and include the file in all pages.
>
> Can you suggest an easy method so that I need not to modify all the
> pages to include the new file?


No. Unless you mean local programming in C++ or VB etc..
> I think your logic says that if the Session Variable "started" is
> empty then only assign the Session Variable with the Referral URL else
> no.


Otherwise Session("ReferralURL") would be filled with each referring
local page.
> But dont you think I should also crear these variables on
> Session_OnEnd event? Please suggest.


As I said, no.

1 Session variables without sessions are deleted automaticly.

2 Session_OnEnd firing is unrelyable.

3 Sessions do not end, when the user "leaves" [sloppy defined] the site,
but only when the session times out or with commands like session.abandon
or with the server closing down/restarting.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


Hi Evertjan,

Thanks for the reply. Now I understodd the concept. Thanks for the post.

Prabaht

Sep 1 '05 #6
Evertjan. wrote:
You mean to say if I put the Session("ReferralURL") =
Request.ServerVariables("HTTP_REFERER") in Session_OnStart it will
not work. I have also tested that and it is not working. Can you
please explain why? Because as per my knowledge the Session_OnStart
event will start for each session.


It is als per specification. Only certein objects are available
in global.asa, I think


This would appear to contradict that claim:

"All the built-in objects (Application Object, ObjectContext
Object, Request Object, Response Object, Server Object, and
Session Object) are available and can be referenced in the
Session_OnStart event script."

http://msdn.microsoft.com/library/en...f289198c16.asp

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Sep 1 '05 #7
Aaron Bertrand [SQL Server MVP] wrote on 01 sep 2005 in
microsoft.public.inetserver.asp.general:
Does anybody see what's wrong with bottom-posting here? Just curious if
it's only me that is irritated to scroll through 90 lines of re-hashed
garbage to see "thank you."


Bottom-posting is not the alternative of top-posting, Aaron.
Re-posting garbage is always a bad habit.
Sparse inter-posting is the best.
Top-posting should be discouraged at all times on usenet.

I am sorry that you ar so easily irritated,
and thereby forgetting what 30 years of
usenet experience brought us:
Netiquette.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 1 '05 #8
Nah, it's lack of snipping, not where the reply was put.

Aaron Bertrand [SQL Server MVP] wrote:
Does anybody see what's wrong with bottom-posting here? Just curious
if it's only me that is irritated to scroll through 90 lines of
re-hashed garbage to see "thank you."


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Sep 1 '05 #9
"Aaron Bertrand [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
"Prabhat" <no********@hotmail.com> wrote in message
news:Om**************@TK2MSFTNGP12.phx.gbl...

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
Prabhat wrote on 01 sep 2005 in microsoft.public.inetserver.asp.general:
> "Evertjan." <ex**************@interxnl.net> wrote in message
>> Prabhat wrote on 01 sep 2005 in
... >> > this in "global.asa" file in "Session_OnStart" event like this:
>> >
>> > Sub Session_OnStart
>> > Session("ReferralURL") = Request.ServerVariables("HTTP_REFERER")
>> > End Sub
>>
>> Seting a session variable here will not work, IMHO.
>>
>> > Sub Session_OnEnd
>> > Session("ReferralURL") = ""
>> > End Sub
>>
>> Clearing a session variable here has no effect, since all session
>> variables die with the end of a session anyway.
>>
>> > So that I can use the session variable any where in my website,
>> > because the HTTP_REFERER will give the URL of the last webpage.
>>
>> No, in your case it would [but doesn't] give only the URL of referral
>> site when opening the session.
>>
>> Better put this file as an include
>> <!--#include virtual ="/test/myInclude.asp"-->
>> on all your pages:
>>
>> /test/myInclude.asp:
>> <%
>> if Session("started") = "" then
>> Session("ReferralURL") = Request.ServerVariables("HTTP_REFERER")
>> Session("started") = "yes!"
>> end if
>> %>

[please do not toppost on usenet]

> You mean to say if I put the Session("ReferralURL") =
> Request.ServerVariables("HTTP_REFERER") in Session_OnStart it will not
> work. I have also tested that and it is not working. Can you please
> explain why? Because as per my knowledge the Session_OnStart event
> will start for each session.

It is als per specification. Only certein objects are available
in global.asa, I think

> As per your suggestion I will create one .asp file with the sample
> code and include the file in all pages.
>
> Can you suggest an easy method so that I need not to modify all the
> pages to include the new file?

No. Unless you mean local programming in C++ or VB etc..

> I think your logic says that if the Session Variable "started" is
> empty then only assign the Session Variable with the Referral URL else
> no.

Otherwise Session("ReferralURL") would be filled with each referring
local page.

> But dont you think I should also crear these variables on
> Session_OnEnd event? Please suggest.

As I said, no.

1 Session variables without sessions are deleted automaticly.

2 Session_OnEnd firing is unrelyable.

3 Sessions do not end, when the user "leaves" [sloppy defined] the site,
but only when the session times out or with commands like
session.abandon
or with the server closing down/restarting.


Hi Evertjan,

Thanks for the reply. Now I understodd the concept. Thanks for the post.


[repositioned from top-posted reply]
Does anybody see what's wrong with bottom-posting here? Just curious if
it's only me that is irritated to scroll through 90 lines of re-hashed
garbage to see "thank you."


Nowhere near as irritating as someone who breaks the flow of a thread.
Sep 1 '05 #10
"Aaron Bertrand [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
Does anybody see what's wrong with bottom-posting here? Just curious if
it's only me that is irritated to scroll through 90 lines of re-hashed
garbage to see "thank you."


[snip]
Why should I not top-post?
http://www.html-faq.com/etiquette/?toppost

"One reason why top-posting is so disliked is that those who do it very
rarely bother to snip any of the preceding post(s) - they leave masses of
quoted text trailing underneath their (frequently very brief) reply."
Usenet Basics
http://mugsy.org/asa_faq/getting_along/usenet.shtml

2. Replying and Quoting

There are many arguments about how to reply to a post on Usenet. There are
standard conventions and on a.s.a we have our preferred styles, briefly
described below.

a. Should I leave in the post I'm replying to, or delete it?

Snip (delete) the parts of a post you're not responding to directly, but
leave in some parts so people know what you're referring to.
Sep 1 '05 #11
Dave Anderson wrote on 01 sep 2005 in
microsoft.public.inetserver.asp.general:
Evertjan. wrote:
It is als per specification. Only certein objects are available
in global.asa, I think


This would appear to contradict that claim:

"All the built-in objects (Application Object, ObjectContext
Object, Request Object, Response Object, Server Object, and
Session Object) are available and can be referenced in the
Session_OnStart event script."

http://msdn.microsoft.com/library/en...cc8-361e-418b-
99e0-b0f289198c16.asp


Thank you, Dave.

I thought I had heard otherwise, but clearly I am wrong.

What do you think could be Prabhat's problem then?
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 1 '05 #12
> Bottom-posting is not the alternative of top-posting, Aaron.
Re-posting garbage is always a bad habit.
You did it in this very thread.
Top-posting should be discouraged at all times on usenet.
WHY? Because you say so? Because one guy somewhere stated that he doesn't
like it? Blow it out your shorts.
I am sorry that you ar so easily irritated,
No, I was just showing an example where your constant "do not top-post on
usenet" leads to an even less desirable behavior.
and thereby forgetting what 30 years of
usenet experience brought us:
Netiquette.


So sorry grand master, you know all and I am an idiot. Bottom-post away.
Sep 1 '05 #13
Evertjan gets bent out of shape every time anyone top-posts. I do sometimes
because it's easy, and sometimes because it puts the most relevant content
"above the fold" -- e.g. less scrolling and scanning. More often, I
intersperse my comments where they're relevant, unless I'm only responding
to a single segment of the previous post (such as this example).

AFAIC, neither is a should or shouldn't thing, it is a personal preference.
Unlike Evertjan, I don't attack people who do one or the other and try to
coerce them to my point of view, and try to say that my view and
interpretation of netiquette is superior to all others. In this case, I was
highlighting it because it was a very good example of what bottom-posting
naturally leads to -- scrolling to the bottom of a 90-line message and
adding a one-liner at the end.


Nah, it's lack of snipping, not where the reply was put.

Sep 1 '05 #14
This is ridiculous. I don't see how this is any more likely with
top-posting than bottom-posting. This thread should serve as a prime
example of where it can happen just as easily with bottom-posting.

Evertjan has attacked me in the past for top-posting and I can not remember
any situation where it had anything to do with me carelessly leaving useless
garbage in my reply.

"One reason why top-posting is so disliked is that those who do it very
rarely bother to snip any of the preceding post(s) - they leave masses of
quoted text trailing underneath their (frequently very brief) reply."

Sep 1 '05 #15
Aaron Bertrand [SQL Server MVP] wrote on 01 sep 2005 in
microsoft.public.inetserver.asp.general:
Bottom-posting is not the alternative of top-posting, Aaron.
Re-posting garbage is always a bad habit.


You did it in this very thread.


What is garbage and what is not is in the eye of the beholder. ;-)
Top-posting should be discouraged at all times on usenet.


WHY? Because you say so? Because one guy somewhere stated that he
doesn't like it? Blow it out your shorts.


Why so aggressive, Aaron?

Again and again in the years I tell my meaning about preferred behavour
on usenet. I know you think differently. So be it. That does not mean I
should not tell others.
I am sorry that you ar so easily irritated,


No, I was just showing an example where your constant "do not top-post
on usenet" leads to an even less desirable behavior.

Aaron:
it's only me that is irritated

See, you came up with the the word "irritated"!
and thereby forgetting what 30 years of
usenet experience brought us:
Netiquette.


So sorry grand master, you know all and I am an idiot. Bottom-post
away.


Thank you, Aaron, if you say so.

However, I did not advocate bottom-posting,
I politely asked not to top-post.
I don't think you are an idiot,
I think you are one of the mainstays of this NG.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 1 '05 #16
Aaron Bertrand [SQL Server MVP] wrote on 01 sep 2005 in
microsoft.public.inetserver.asp.general:
Evertjan has attacked me in the past for top-posting and I can not
remember any situation where it had anything to do with me carelessly
leaving useless garbage in my reply.


See, still you are irritated, Aaron.

Please don't be.

As far as I can remember,
I never attacked anyone,
unless you call a polite

"[please do not toppost on usenet]"

an attack.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 1 '05 #17
> This would appear to contradict that claim:

"All the built-in objects (Application Object, ObjectContext
Object, Request Object, Response Object, Server Object, and
Session Object) are available and can be referenced in the
Session_OnStart event script."

http://msdn.microsoft.com/library/en...61e-418b-99e0-
b0f289198c16.asp

Hi Dave,

Can you please lookinto my problem in the 1st post in this thread. Can you
please put some light on that or can you suggest me how can i do that?

Thanks
Prabhat
Sep 1 '05 #18
> Thank you, Dave.

I thought I had heard otherwise, but clearly I am wrong.

What do you think could be Prabhat's problem then?


Hi,

can you now suggest any thing?

Thanks
Prabhat
Sep 1 '05 #19
Prabhat wrote on 01 sep 2005 in microsoft.public.inetserver.asp.general:
Thank you, Dave.

I thought I had heard otherwise, but clearly I am wrong.

What do you think could be Prabhat's problem then?


Hi,

can you now suggest any thing?


Yes, testing!

Set a session variable with global.asa onstart,
and try to tead it on a page.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 1 '05 #20
HTTP_REFERER is not always available (see http://www.aspfaq.com/2169). This
is, however, not one of those cases. This technique worked fine for me, as
long as the click actualy started a new session. I just did this on my own
box, with an HTML file I called from http://localhost/file.htm, with a link
to http://my_machine_name/file.asp, where global.asa in the root set a
session variable just like you do below, and file.asp outputs the session
variable. Worked flawlessly, as long as I started from scratch (e.g. closed
the browser).

If you are on your site, and then go to Google, and click on a link that
takes you to your site, session_onstart() won't fire because you still have
the old session.

Don't try to set the string to an empty string in session_onEnd. There is
no point. If session_onEnd is actually being called, then your variables
are blown away for you. But more often than not, it will not be called
(see http://www.aspfaq.com/2078).

My guess is that session variables are not working
(http://www.aspfaq.com/2157) or global.asa is not being called at all (see
http://www.aspfaq.com/2076). To isolate the problem, create a global.asa
that sets a session variable (just a constant/string, not based on
servervariables) in session_onstart. Open a new browser window, navigate to
a page that sets a different session variable, then navigate to a third page
that displays them both.


Then I should able to know the referrer URL. How Do I get that?

I know about Request.ServerVariables("HTTP_REFERER"). So I used this in
"global.asa" file in "Session_OnStart" event like this:

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


Sep 1 '05 #21
Evertjan. wrote:
Thank you, Dave.

I thought I had heard otherwise, but clearly I am wrong.

What do you think could be Prabhat's problem then?


Probably a lack of understanding of either (a) when a session starts, or (b)
when the HTTP_REFERER header is sent.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Sep 2 '05 #22
I wrote:
What do you think could be Prabhat's problem then?


Probably a lack of understanding of either (a) when a session
starts, or (b) when the HTTP_REFERER header is sent.


Aaron was probably right on when he suggested global.asa was not firing at
all. This would be true if the OP failed to set up the folder as an
Application, and would fall under (a) above.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Sep 2 '05 #23
> Set a session variable with global.asa onstart,
and try to tead it on a page.

Hi did you get any thing to help me? Prabhat
Sep 26 '05 #24
Prabhat wrote on 26 sep 2005 in microsoft.public.inetserver.asp.general:
Set a session variable with global.asa onstart,
and try to tead it on a page.

Hi did you get any thing to help me? Prabhat


Who are you talking to?

Please try to quote correctly, with "xxx wrote on yyy:".

This thread has been dead for 25 days.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 26 '05 #25
> Who are you talking to?

Please try to quote correctly, with "xxx wrote on yyy:".

This thread has been dead for 25 days.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


Hi Evertjan,

It was for you.

Prabhat
Sep 26 '05 #26
Hi,

["Evertjan" wrote on 01-Sep-2005]
Yes, testing!

Set a session variable with global.asa onstart,
and try to tead it on a page.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


Hi Evertjan,

Did you get any thing to help me?

Thanks
Prabhat
Sep 26 '05 #27
Prabhat wrote on 26 sep 2005 in microsoft.public.inetserver.asp.general:
Hi,

["Evertjan" wrote on 01-Sep-2005]
Yes, testing!

Set a session variable with global.asa onstart,
and try to tead it on a page.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


Hi Evertjan,

Did you get any thing to help me?


sorry, no.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 26 '05 #28
> 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 referrer URL. How Do I get that?

I know about Request.ServerVariables("HTTP_REFERER"). So I used this in
"global.asa" file in "Session_OnStart" event like this:

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

Sub Session_OnEnd
Session("ReferralURL") = ""
End Sub

So that I can use the session variable any where in my website, because the HTTP_REFERER will give the URL of the last webpage.

But this seems to not working.

Please help.

Thanks
Prabhat

Hi All,

I know it is a very old post, But today I got some of the link in google
that I am trying.

Links: http://www.asp101.com/articles/jason...om/default.asp

and
http://www.codehound.com/groups/thread.asp?t=1,187,1,3_**********@dispatch.c
oncentric.net_187

Thanks
Prabhat
Sep 27 '05 #29

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John A. Irwin | last post by:
I'm very new to PHP and am trying to figure out how to parse out a variable "HTTP_REFERER". My reason for this is my site was recently "FEATURED" (sic) on a website called FARK.COM. Because of...
9
by: Jez | last post by:
Any ideas why I'm not able to use $_SERVER on my shared hosting account (PHP 4.1.2), but I can on my local server (PHP 4.3.3)? I imagine it has something to do with the different versions of PHP...
9
by: deko | last post by:
I have a page that I don't want anyone to be able to link directly to. The page should only be accessed from gatepage.php. I tried this code, but keep getting errors - "header info already sent",...
2
by: ssk | last post by:
Hello! I made a web site using PHP Open sources for message board. Everything's fine except one computer can't open a message writing page. The code that gives an error is the following. ...
2
by: M Smith | last post by:
On our web site we allow our members access to features hosted by another web site. The way the other web site authenticates users is to check the value of the HTTP_REFERER. If it comes from our...
4
by: Ringo Langly | last post by:
Hi everyone, We're using an outside vendor to provide some content for our website, and they use the http_referer variable to verify their content is only viewed from subscribing customers. ...
8
by: tshad | last post by:
Why would HTTP_REFERER not be there in the Page_Load event? I am using it to determine whether a page was called from a particular page. I am doing: sTest =...
16
by: Seguros Catatumbo | last post by:
Hi everyone. Is there a way i can find out the value of HTTP_REFERER when using application_error in global.asax? I am using: if (HttpContext.Current.Request.ServerVariables != null) {...
6
by: Lorna | last post by:
I can't seem to get the ENV variable HTTP_REFERER when posting with CGI from one program to another. In my post program I have put in the <HEAD> HTTP_REFERER =my host - ie www.xyz.com (I have...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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
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...

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.