public EvictSession ( |
||
session | ||
return | void |
// // SessionStateProviderBase.RemoveItem // public override void RemoveItem(HttpContext context, string id, object lockId, SessionStateStoreData item) { var sessionStore = new SessionStore(this._applicationName); try { sessionStore.EvictSession(id, this._applicationName, lockId); } catch (Exception e) { if (WriteExceptionsToEventLog) { WriteToEventLog(e, "RemoveItem"); throw new ProviderException(e.Message, e.InnerException); } else { throw e; } } }
// // GetSessionStoreItem is called by both the GetItem and // GetItemExclusive methods. GetSessionStoreItem retrieves the // session data from the data source. If the lockRecord parameter // is true (in the case of GetItemExclusive), then GetSessionStoreItem // locks the record and sets a new LockId and LockDate. // private SessionStateStoreData GetSessionStoreItem(bool lockRecord, HttpContext context, string id, out bool locked, out TimeSpan lockAge, out object lockId, out SessionStateActions actionFlags) { // Initial values for return value and out parameters. SessionStateStoreData item = null; lockAge = TimeSpan.Zero; lockId = null; locked = false; actionFlags = 0; // byte array to hold serialized SessionStateItemCollection. byte[] serializedItems = new byte[0]; var sessionStore = new SessionStore(_applicationName); try { Session session = sessionStore.Get(id, this._applicationName); // lockRecord is true when called from GetItemExclusive and // false when called from GetItem. // Obtain a lock if possible. Evict the record if it is expired. if (session == null) { // Not found. The locked value is false. locked = false; } else if (session.Expires < DateTime.Now) { locked = false; sessionStore.EvictSession(session); } else if (session.Locked) { locked = true; lockAge = DateTime.Now.Subtract(session.LockDate); lockId = session.LockID; } else { locked = false; lockId = session.LockID; actionFlags = (SessionStateActions)session.Flags; if (lockRecord) { lockId = (int)lockId + 1; session.LockID = lockId; session.Flags = 0; sessionStore.LockSession(session); } if (actionFlags == SessionStateActions.InitializeItem) item = CreateNewStoreData(context, sessionStateSection.Timeout.Minutes); else item = Deserialize(context, session.SessionItems.Bytes, session.Timeout); } } catch (MongoConnectionException e) { if (WriteExceptionsToEventLog) { WriteToEventLog(e, "GetSessionStoreItem"); throw new ProviderException(e.Message, e.InnerException); } else throw e; } return item; }
// // GetSessionStoreItem is called by both the GetItem and // GetItemExclusive methods. GetSessionStoreItem retrieves the // session data from the data source. If the lockRecord parameter // is true (in the case of GetItemExclusive), then GetSessionStoreItem // locks the record and sets a new LockId and LockDate. // private SessionStateStoreData GetSessionStoreItem(bool lockRecord, HttpContext context, string id, out bool locked, out TimeSpan lockAge, out object lockId, out SessionStateActions actionFlags) { // Initial values for return value and out parameters. SessionStateStoreData item = null; lockAge = TimeSpan.Zero; lockId = null; locked = false; actionFlags = 0; // byte array to hold serialized SessionStateItemCollection. byte[] serializedItems = new byte[0]; var sessionStore = new SessionStore(_applicationName); try { Session session = sessionStore.Get(id, this._applicationName); // lockRecord is true when called from GetItemExclusive and // false when called from GetItem. // Obtain a lock if possible. Evict the record if it is expired. if (session == null) { // Not found. The locked value is false. locked = false; } else if (session.Expires < DateTime.Now) { locked = false; sessionStore.EvictSession(session); } else if (session.Locked) { locked = true; lockAge = DateTime.Now.Subtract(session.LockDate); lockId = session.LockID; } else { locked = false; lockId = session.LockID; actionFlags = (SessionStateActions)session.Flags; if (lockRecord) { lockId = (int)lockId + 1; session.LockID = lockId; session.Flags = 0; sessionStore.LockSession(session); } if (actionFlags == SessionStateActions.InitializeItem) { item = CreateNewStoreData(context, sessionStateSection.Timeout.Minutes); } else { item = Deserialize(context, session.SessionItems.Bytes, session.Timeout); } } } catch (MongoConnectionException e) { if (WriteExceptionsToEventLog) { WriteToEventLog(e, "GetSessionStoreItem"); throw new ProviderException(e.Message, e.InnerException); } else { throw e; } } return(item); }
// // SessionStateProviderBase.RemoveItem // public override void RemoveItem(HttpContext context, string id, object lockId, SessionStateStoreData item) { var sessionStore = new SessionStore(this._applicationName); try { sessionStore.EvictSession(id, this._applicationName, lockId); } catch (Exception e) { if (WriteExceptionsToEventLog) { WriteToEventLog(e, "RemoveItem"); throw new ProviderException(e.Message, e.InnerException); } else throw e; } }