juststarted
IS-IT--Management
Hi ASP People,
I just started using ASP and already have encountered a problem trying to get this simple code to work. I want to count a number of current users of the application and it looks like it just keeps to grow. I close browser window - the count doesn't change. I open new browser window - the count increments by one.
here's the code:
global.asa
Sub Application_OnStart
Application("usCount" = 0
End Sub
Sub Session_OnStart
Application.Lock
Application("usCount"=Application("usCount"+1
Application.UnLock
End Sub
Sub Session_OnEnd
Application.Lock
Application("usCount"=Application("usCount"-1
Application.UnLock
End Sub
default.asp
<%@ Language=VBScript %>
<%Response.Buffer=0%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<meta http-equiv="refresh" content="3">
</HEAD>
<BODY>
<h1>Welcome!!!</h1><br><br><br><br>
<%Application.Lock%>
You are the user number <%=Application("usCount"%>
<%Application.UnLock%>
</BODY>
</HTML>
Both pages are in the application.
So, could anyone find out what I'm doing wrong?
Thanks a lot.
I just started using ASP and already have encountered a problem trying to get this simple code to work. I want to count a number of current users of the application and it looks like it just keeps to grow. I close browser window - the count doesn't change. I open new browser window - the count increments by one.
here's the code:
global.asa
Sub Application_OnStart
Application("usCount" = 0
End Sub
Sub Session_OnStart
Application.Lock
Application("usCount"=Application("usCount"+1
Application.UnLock
End Sub
Sub Session_OnEnd
Application.Lock
Application("usCount"=Application("usCount"-1
Application.UnLock
End Sub
default.asp
<%@ Language=VBScript %>
<%Response.Buffer=0%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<meta http-equiv="refresh" content="3">
</HEAD>
<BODY>
<h1>Welcome!!!</h1><br><br><br><br>
<%Application.Lock%>
You are the user number <%=Application("usCount"%>
<%Application.UnLock%>
</BODY>
</HTML>
Both pages are in the application.
So, could anyone find out what I'm doing wrong?
Thanks a lot.