Put this in Global.asa / Global.asax
VB Code:
Sub Session_OnStart
Application.Lock
Application("UserCount") = Application("UserCount") + 1
format.
Application.Unload
End Sub
ยจ
Sub Session_OnEnd
Application.Lock
Application("UserCount") = Application("UserCount") - 1
format.
Application.Unload
End Sub
now on the page where you wish to display the number of users do like this:
Users online now: <%=Application("UserCount")%>
Please notice that 20 minutes (or whatever your Session.Timeout value is set to) will pass by before the Session_OnEnd event is fired. Therefore the number generated is not entirely accurate!
Hope this helps.