User chk

how i check how many users are connect to my web app

You can have an Admin page and it returns the total active sessions.

If by users you mean sessions, then use App.SessionCount. If you really mean users, some of which could have more than one session going, then you’ll have to use other information for that, most likely cookies. And note that some sessions may be disconnected and not yet destroyed. The following will give you some useful information (accredited to Brad Hutchings):

Dim s As String Dim dictionaryCount, actualSessionCount As Integer #pragma BackgroundTasks False actualSessionCount = 0 dictionaryCount = 0 Dim oi As Runtime.ObjectIterator oi = Runtime.IterateObjects While oi.MoveNext If Introspection.GetType(oi.Current).Name = "Session" Then actualSessionCount = actualSessionCount + 1 End If If Introspection.GetType(oi.Current).Name = "Dictionary" Then dictionaryCount = dictionaryCount + 1 End If Wend #pragma BackgroundTasks True s = "Memory Used: " + Format(Runtime.MemoryUsed, "0,") + EndOfLine + _ "Object Count: " + Format(Runtime.ObjectCount, "0,") + EndOfLine + _ "SessionCount: " + Format(app.SessionCount, "0") + EndOfLine + _ "(actual) SessionCount: " + Format(actualSessionCount, "0") + EndOfLine + _ "DictionaryCount: " + Format(dictionaryCount, "0") + EndOfLine + _ "ActiveConnectionCount: " + Str(Session.ActiveConnectionCount) MsgBox s


what book do you use to read and learn all this ?

Unfortunately, no book, other than the LR for hacking my way through introspection on occasion. The active session count comes from experience, observing that app.SessionCount wasn’t always reporting what I expected.