By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,708 Members | 1,502 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,708 IT Pros & Developers. It's quick & easy.

Use of HTTP_REFERER in Global.asa

P: n/a
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
Share this Question
Share on Google+
28 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

"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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
"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

P: n/a
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

P: n/a
> 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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
> 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

P: n/a
> 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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
> 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

P: n/a
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

P: n/a
> 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

P: n/a
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

P: n/a
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

P: n/a
> 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 discussion thread is closed

Replies have been disabled for this discussion.