public void Logout(SessionId sessionId) { if (sessionId != null) { try { _Sync.AcquireWriterLock(Timeout.Infinite); if (_AuthorizedUsers.ContainsKey(sessionId.Id)) { _AuthorizedUsers.Remove(sessionId.Id); } //CallContext.FreeNamedDataSlot("id"); // session may be already destroyed here(?) try { GenuineUtility.CurrentSession["id"] = null; } catch { } } finally { _Sync.ReleaseWriterLock(); } } }
public User GetUser(SessionId sessionId) { if (sessionId != null) { try { _Sync.AcquireReaderLock(Timeout.Infinite); UserItem ui; if (_AuthorizedUsers.TryGetValue(sessionId.Id, out ui)) { return ui.User; } else { return null; } } finally { _Sync.ReleaseReaderLock(); } } return null; }