473,698 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ServerV ariables("HTTP_ REFERER"). So I used this in
"global.asa " file in "Session_OnStar t" event like this:

Sub Session_OnStart
Session("Referr alURL") = Request.ServerV ariables("HTTP_ REFERER")
End Sub

Sub Session_OnEnd
Session("Referr alURL") = ""
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
28 4880
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.ServerV ariables("HTTP_ REFERER"). So I used this in
"global.asa " file in "Session_OnStar t" event like this:

Sub Session_OnStart
Session("Referr alURL") = Request.ServerV ariables("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.publi c.inetserver.as p.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.publi c.inetserver.as p.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.ServerV ariables("HTTP_ REFERER"). So I used this in
"global.asa " file in "Session_OnStar t" event like this:

Sub Session_OnStart
Session("Referr alURL") = Request.ServerV ariables("HTTP_ REFERER")
End Sub

Sub Session_OnEnd
Session("Referr alURL") = ""
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.c om/groups/thread.asp?t=1, 187,1,3_******* ***@dispatch.c
oncentric.net_1 87

Thanks
Prabhat
Sep 27 '05 #29

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

Similar topics

2
9558
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 this I received over 100,000 Hits in less then one hour and it caused my host's server farm to crash. While I understand that I could move to a more robust Web Host, I would rather trap any further links from FARK and redirect them to a rejection...
9
30888
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 or perhaps php.ini, but I'm not sure what? Thanks! Jez
9
28675
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", or something like that... Am I missing something, or is there a better way to do this? <?php $ref = $_SERVER; //echo $ref; if ( $ref == 'http://www.mydomain.com/gatepage.php' ) {
2
5634
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. if(!eregi($HTTP_HOST,$HTTP_REFERER)) Error("Write in the normal way");
2
1666
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 Login.asp page it lets them in. When our users login to go to the other site, they login on our site's Login.asp page. When they click submit, our LoginCheck.asp page validates them and does a response.redirect to the other site. In most cases...
4
5286
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. Anyway, we're using the mm_menu javascript menu for our web menus, and under only Internet Explorer it's not passing the http_referer -- which means any site of theirs we link to from the menu doesn't work. This works fine in Firefox, Mozilla, and...
8
1856
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 = Request.ServerVariables("HTTP_REFERER") if (sTest = "") ORELSE (sTest.SubString(sTest.LastIndexOf("/")+1) <> "job_posting_new2.aspx") then newPosition = new Position
16
3778
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) { referencia = HttpContext.Current.Request.ServerVariables.ToString();
6
5355
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 also tried removing it entirely in case that was causing problems. I have tried to extract the HTTP_REFERER in my receiving program with $http_ref = $ENV{'HTTP_REFERER'}; That didn't work so I just printed all variables with foreach $key...
0
8608
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9029
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7732
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6522
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4370
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2006
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.