andyhill Posted December 9, 2018 Share Posted December 9, 2018 I am recording every SessionID, IP and UserName for every user who accesses my website. I have noticed that some users (either due to impatience or hapatic feedback insensitivities) are running multiple browser sessions at the same time and I want to limit them to a maximum of one session at a time - the current one - by automatically closing any previous ones. After fetching previous SessionID and IP used on last access I attempt to close it (release). My code below executes correctly but it appears that the legacy session is not removed after calling ReleaseSession - please advise - thanks in advance. procedure TUniServerModule.KillActiveSession(SessionID, IP: String); var sid: TUniGUISession; ActiveSessions: TUniGUISessions; begin try ActiveSessions:= UniServerModule.SessionManager.Sessions; sid:= ActiveSessions.GetSession(SessionID, IP); sid.ReleaseSession; except end; end; Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted December 9, 2018 Share Posted December 9, 2018 Instead of killing session, You can forbid access by displaying a message when the user attempt to login with the same machine ( IP) : "Oups...you have already an active session..bla...bla...bla..." Quote Link to comment Share on other sites More sharing options...
Tokay Posted December 9, 2018 Share Posted December 9, 2018 Maybe UniServerModule>ServerLimits>SessionRestrict can help you? Quote Link to comment Share on other sites More sharing options...
andyhill Posted December 9, 2018 Author Share Posted December 9, 2018 It actually has to do with my Google Maps License. Google will not accept the same IP, same Device (mobile in my case) concurrently having two sessions using GeoCoder/GetCurrentPosition. I need to destroy the legacy session. 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.