Show current user count on your web site

Submitted by:Tim Kelly

Date added:03 November, 2011

Category:ASP

To get a user count the code below goes in your "global.asa" file which needs to go in the root of your web site. You web site must be properly set up as an application in IIS for this file to fire and do it's thing.

Tags: count user

Code Snippet:

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
Application("WhoOn") = 0
End Sub
Sub Session_OnStart
Application.Lock
Application("WhoOn") = Application("WhoOn") + 1
Application.Unlock
End Sub
Sub Session_OnEnd
Application.Lock
Application("WhoOn") = Application("WhoOn") - 1
Application.Unlock
End Sub
</SCRIPT>
 
 

Comments