andyhill Posted December 15, 2019 Share Posted December 15, 2019 My code below walks through ALL MainModules fetching their MyUserName's - All Good. Problem, when sessions are no longer active (closed down [browser gone]) they still show up as active connected sessions. How can I determine if a session in the list has died ??? function TUniServerModule.GetSessionLoggedInUserNames(): String; var I: Integer; S: TUniGUISessions; U: TUniGUISession; begin Result:= ''; S:= UniServerModule.SessionManager.Sessions; S.Lock; try SetLength(ASessionList, S.SessionList.Count); for I:= 0 to S.SessionList.Count - 1 do begin U:= S.SessionList; ASessionList.ASessionId:= U.SessionId; ASessionList.AIP:= U.RemoteIP; ASessionList.ALastTime:= U.LastTimeStamp; if U.UniMainModule <> nil then begin if U.Active = True then begin // Need Dead Session Logic Here if I = 0 then begin Result:= (U.UniMainModule as TUniMainModule).MyUserName; end else begin Result:= Result + ', ' + (U.UniMainModule as TUniMainModule).MyUserName; end; end; end; end; finally S.Unlock; end; end; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.