473,508 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem setting up Application-scoped counter in global.asa

Hi,

I'm trying to set up a simple application-scoped counter in global.asa
to display on my webpages. When I call Application("VisitorCount") on
another page as shown:

<%
response.write "Visitor: " & Application("VisitorCount")
%>

I get nothing.

Can anyone help me out?

The code below shows the applicable part of what I have in my global.asa
file.

I'd really appreciate it if someone would help me out with this.

Thanks...

--- start code
SUB Application_OnStart
Application("VisitorCount") = 0
end sub

SUB Session_OnStart
session("sql") = ""
session("query") = ""
'lock the application for concurrency reasons
Application.Lock
Application("VisitorCount") = Application("VisitorCount") + 1
Application.UnLock
end sub
--- end code
--
Wayfarer
Journeys: http://wayfarer.brinkster.net/contact.asp
Jul 19 '05 #1
3 1983
Try this:

sub Application_OnStart
Application("VisitorCount") = 0
end sub

sub Session_OnStart
session("sql") = ""
session("query") = ""
'lock the application for concurrency reasons
Application.Lock
Application("VisitorCount") = CDbl(Application("VisitorCount")) + 1
Application.UnLock
end sub

-dlbjr

Discerning resolutions for the alms
Jul 19 '05 #2
Have you restarted the website since you added this code? I suspect the
VisitorCount is empty. In Session_OnStart, do this:

Application.Lock
if len(Application("VisitorCount")) = 0 then
Application("VisitorCount") = 1
else
Application("VisitorCount") = CLng(Application("VisitorCount")) + 1
end if
Application.UnLock

HTH,
Bob Barrows

Wayfarer wrote:
Hi,

I'm trying to set up a simple application-scoped counter in global.asa
to display on my webpages. When I call Application("VisitorCount") on
another page as shown:

<%
response.write "Visitor: " & Application("VisitorCount")
%>

I get nothing.

Can anyone help me out?

The code below shows the applicable part of what I have in my
global.asa file.

I'd really appreciate it if someone would help me out with this.

Thanks...

--- start code
SUB Application_OnStart
Application("VisitorCount") = 0
end sub

SUB Session_OnStart
session("sql") = ""
session("query") = ""
'lock the application for concurrency reasons
Application.Lock
Application("VisitorCount") = Application("VisitorCount") + 1
Application.UnLock
end sub
--- end code


Jul 19 '05 #3
Thus spake Bob Barrows:
Have you restarted the website since you added this code? I suspect the
VisitorCount is empty. In Session_OnStart, do this:

Application.Lock
if len(Application("VisitorCount")) = 0 then
Application("VisitorCount") = 1
else
Application("VisitorCount") = CLng(Application("VisitorCount")) + 1
end if
Application.UnLock

HTH,
Bob Barrows

Wayfarer wrote:
Hi,

I'm trying to set up a simple application-scoped counter in global.asa
to display on my webpages. When I call Application("VisitorCount") on
another page as shown:

snip

That did it. Thanks for your help!

--
Wayfarer
Journeys: http://wayfarer.brinkster.net/contact.asp
Jul 19 '05 #4

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

Similar topics

5
3024
by: | last post by:
Hi, I'm trying to use the cookie munging session handling behaviour of asp.net instead of cookies themselves as I'm finding quite a few people are barring cookies (especially AOL users). If I...
8
3364
by: nick | last post by:
I have a problem and I've been using a cheezy work around and was wondering if anyone else out there has a better solution. The problem: Let's say I have a web application appA. Locally, I set...
15
2380
by: Ron L | last post by:
We are working on a distributed VB.Net application which will access a SQL database located on a known server. Each client will run on the user's local machine. To implement this, we are trying...
36
2431
by: AussieRules | last post by:
Hi, I want to use the user color scheme to set the color of my forms. I now I have to use the. System.Drawing.SystemColors, but which color is the color of a form background as used in other...
5
4062
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
7
2078
by: Rabbit | last post by:
Dear all, Does anyone know how to resolve following setup problem, I developed my application(using .net 2.0) which will connect Access database on my Win XP, everything works fine, but when I...
1
1736
by: GAZ | last post by:
Hello all, We have a bit of a problem with application settings and user control. In short, we have developed a user control that should, as it happenes, get a value stored in application...
5
2917
by: snow | last post by:
Hi All, ToOADate can change a date value to a double value, but if I change the Regional and Lauguage setting in control panel, for example, change English(US) to English(Australia) , the same...
14
2273
by: GaryDean | last post by:
The web.config in my asp.net application, running on Server2003, has this entry: <sessionState mode="InProc" timeout="40". In IIS the asp.net State Management timeout setting is 40 for my website....
3
1941
by: Dreea | last post by:
Hello i have a .netapplication that runs with no problem when launched from the local machine, but when i try to run the same executable from the network the applications doesn't start. I suppose...
0
7225
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
7123
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
7324
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
7382
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...
1
7042
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...
0
7495
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
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1556
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
418
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.