How Many Users Are Online

The codes contain two parts. The first part is part of the "global.asax" file which is to be placed directly under your root directory. The second part is the code to display the actual number of people online.

			
                                Sub Application_OnStart
                                    Application("WhoOn") = 0
                                End Sub
                                
                                Sub Session_OnStart
                                    Session.Timeout = 20
                                    '---lock Application variable before updating
                                    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
                        
                         
		

code to display the actual number online:

			
                                lblOnlineUsers = Application("WhoOn")