Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global ASA not updating!?

Status
Not open for further replies.

irate

Programmer
Jan 29, 2001
92
GB
I am using a standard ASA to track the users of my intranet. It works tracking users logging on but it doesnt seem to track them log off...?

Do I need to set an application timeout or something, i would like this counter to be very accurate.

Example, i go to a page on my intranet and it says there is one user logged on.
If i open three other browsers to the intranet it says there are 4 users after a refresh.
But if i close two browsers (expecting it to say 2 users) it still says 4 users after a refresh?

this is the asa:

<SCRIPT LANGUAGE=&quot;VBScript&quot; RUNAT=&quot;Server&quot;>

Sub Application_OnStart
Application(&quot;ActiveUsers&quot;) = 0
End Sub

Sub Session_OnStart
Application.Lock
Application(&quot;ActiveUsers&quot;) = Application(&quot;ActiveUsers&quot;) + 1
Application.UnLock
End Sub

Sub Session_OnEnd
Application.Lock
Application(&quot;ActiveUsers&quot;) = Application(&quot;ActiveUsers&quot;) - 1
Application.UnLock
End Sub

</SCRIPT>

and this is the page:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<TITLE>mypage</TITLE>
</HEAD>
<BODY>
There are currently<FONT COLOR=&quot;#CC0000&quot;><%= Application(&quot;ActiveUsers&quot;) %></FONT> Active User(s)
</BODY>
</HTML>
 
seeing as you are tracking the session users change the count to be a session count.
Sub Application_OnStart
Application(&quot;ActiveUsers&quot;) = 0
End Sub

Sub Session_OnStart
Application.Lock
Session(&quot;count&quot;)=CInt(Application(&quot;ActiveUsers&quot;))
Session(&quot;count&quot;)=Session(&quot;count&quot;) + 1
Application.UnLock
End Sub

Sub Session_OnEnd
Application.Lock
Session(&quot;count&quot;)=Session(&quot;count&quot;) - 1
Application(&quot;ActiveUsers&quot;) = Session(&quot;count&quot;)
Application.UnLock
End Sub


admin@onpntwebdesigns.com
 
OK i have a better plan...

When ever someone logs on to the site there is a Session variable Session(&quot;User&quot;) that stores their database ID

is it at all possible to use a OnStart routine for that specific session in the asa ?

IE something like:

Sub Session(&quot;User&quot;)_OnStart
Application.Lock
'Do stuff here
Application.UnLock
End Sub
 
depending on if you actually want to count the individual users log in and log off numbers. At that point it would be better to create a field in the DB to count this number and then place it in the page. However this would not effect the counter which is global and not unique to the users at all.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top