/// <summary> /// Process logoff. /// </summary> /// <param name="sessionID">Unique session key</param> public void Logoff(Guid sessionID) { IIdentity identity = null; DateTime timestamp = DateTime.MinValue; var clientAddress = GetCallingClientIPAddress(); var session = _host.SessionManager.GetSessionBySessionID(sessionID); if (session != null) { session.ClientAddress = clientAddress; identity = session.Identity; timestamp = session.Timestamp; } _host.SessionManager.SetCurrentSession(session); _host.SessionManager.RemoveSession(sessionID); try { if (identity != null) { _host.OnClientLoggedOff(new LoginEventArgs(LoginEventType.Logoff, identity, clientAddress, timestamp)); } } finally { // reset current session after the client is logged off _host.SessionManager.SetCurrentSession(null); } }
/// <summary> /// Process logoff. /// </summary> /// <param name="sessionID">Unique session key</param> public void Logoff(Guid sessionID) { IIdentity identity = null; DateTime timestamp = DateTime.MinValue; var session = _host.SessionManager.GetSessionBySessionID(sessionID); if (session != null) { identity = session.Identity; timestamp = session.Timestamp; } _host.SessionManager.RemoveSession(sessionID); string clientIP = string.Empty; IPAddress clientAddress = GetCallingClientIPAddress(); if (clientAddress != null) { clientIP = clientAddress.ToString(); } try { if (identity != null) { _host.OnClientLoggedOff(new LoginEventArgs(LoginEventType.Logoff, identity, clientIP, timestamp)); } } finally { // reset current session after the client is logged off ServerSession.CurrentSession = null; } }