C
cc
From the popular website At this link:
http://www.w3schools.com/asp/asp_globalasa.asp
I got this code, but it does not work on my server... I can open three
IE browsers and watch the count go to three. Upon closing two, each
having separate sessions (and session ID's of course), the count
remains at three! I'm not looking for alternative ways of doing this:
I'm interested in knowing why the application variable does not get
reduced upon ending the session by closing the browser. Any ideas?
Thanks,
See below:
The Global.asa file:
<script language="vbscript" runat="server">
Sub Application_OnStart
Application("visitors")=0
End Sub
Sub Session_OnStart
Application.Lock
Application("visitors")=Application("visitors")+1
Application.UnLock
End Sub
Sub Session_OnEnd
Application.Lock
Application("visitors")=Application("visitors")-1
Application.UnLock
End Sub
</script>
To display the number of current visitors in an ASP file:
<html>
<head>
</head>
<body>
<p>
There are <%response.write(Application("visitors"))%>
online now!
</p>
</body>
</html>
http://www.w3schools.com/asp/asp_globalasa.asp
I got this code, but it does not work on my server... I can open three
IE browsers and watch the count go to three. Upon closing two, each
having separate sessions (and session ID's of course), the count
remains at three! I'm not looking for alternative ways of doing this:
I'm interested in knowing why the application variable does not get
reduced upon ending the session by closing the browser. Any ideas?
Thanks,
See below:
The Global.asa file:
<script language="vbscript" runat="server">
Sub Application_OnStart
Application("visitors")=0
End Sub
Sub Session_OnStart
Application.Lock
Application("visitors")=Application("visitors")+1
Application.UnLock
End Sub
Sub Session_OnEnd
Application.Lock
Application("visitors")=Application("visitors")-1
Application.UnLock
End Sub
</script>
To display the number of current visitors in an ASP file:
<html>
<head>
</head>
<body>
<p>
There are <%response.write(Application("visitors"))%>
online now!
</p>
</body>
</html>