473,659 Members | 3,592 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("Vi sitorCount") on
another page as shown:

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

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_OnS tart
Application("Vi sitorCount") = 0
end sub

SUB Session_OnStart
session("sql") = ""
session("query" ) = ""
'lock the application for concurrency reasons
Application.Loc k
Application("Vi sitorCount") = Application("Vi sitorCount") + 1
Application.UnL ock
end sub
--- end code
--
Wayfarer
Journeys: http://wayfarer.brinkster.net/contact.asp
Jul 19 '05 #1
3 1989
Try this:

sub Application_OnS tart
Application("Vi sitorCount") = 0
end sub

sub Session_OnStart
session("sql") = ""
session("query" ) = ""
'lock the application for concurrency reasons
Application.Loc k
Application("Vi sitorCount") = CDbl(Applicatio n("VisitorCount ")) + 1
Application.UnL ock
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.Loc k
if len(Application ("VisitorCount" )) = 0 then
Application("Vi sitorCount") = 1
else
Application("Vi sitorCount") = CLng(Applicatio n("VisitorCount ")) + 1
end if
Application.UnL ock

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("Vi sitorCount") on
another page as shown:

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

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_OnS tart
Application("Vi sitorCount") = 0
end sub

SUB Session_OnStart
session("sql") = ""
session("query" ) = ""
'lock the application for concurrency reasons
Application.Loc k
Application("Vi sitorCount") = Application("Vi sitorCount") + 1
Application.UnL ock
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.Loc k
if len(Application ("VisitorCount" )) = 0 then
Application("Vi sitorCount") = 1
else
Application("Vi sitorCount") = CLng(Applicatio n("VisitorCount ")) + 1
end if
Application.UnL ock

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("Vi sitorCount") 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
3036
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 change the setting in web.config everything seems to work fine as long as I'm using relative paths. The problem is I've got a menuing system that's generated from a site-wide template - so I use a fixed path from the application root - (ie:...
8
3383
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 it up as C:\domains\appA. Locally, my IIS root points to C:\domains. I don't point it to C:\domains\appA since if I have an appB under C:\domains I wouldn't be able to get to it. So to access it via my browser I go to localhost/appA.
15
2399
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 to use remoting for our access to the SQL server, with the remoting being via IIS. Since all of our users will have accounts in the destination domain, we want to have IIS handle the security for us and not allow anonymous. We have set this up...
36
2469
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 applications. In the end all I want to do is form1.backcolor = system.whatever.color
5
4078
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 both projects. Both controls(dlls) have been signed using SN.exe and I've set up the appropriate .Net assembly permissions using those Strong Names The DLL's have been copied to the /bin directory in both web virtual directories.
7
2081
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 place the web folder onto my Win 2003 server, set up a virtual directory as web application, the following error message came up. Server Error in '/WebApp' Application.
1
1743
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 settings of its host application. The app.config of the host application looks like this: <appSettings> <add key="SQLConnectionString" value="some value" /> </appSettings>
5
2931
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 date time will get different double values from function ToOADate. How to always get the same double value no matter what setting is in control panel? Thanks for the help!
14
2288
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. In IIS the virtual directory configuration setting is set to 40. The application still timesout at 20 minutes. What else can I do? --
3
1951
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 that the .exe.config file has something to do with it. Here is the content of the configuration file <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="userSettings"...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7359
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
6181
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
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
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 we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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.