/// <summary> /// Resets a session timeout /// </summary> /// <param name="context">The current request context</param> /// <param name="id">The session id</param> public override void ResetItemTimeout(HttpContext context, string id) { // Force a session get to update its timeout var ids = SharedSessionIDManager.GetSessionIdAndServer(id); var timestamp = SharedSessionIDManager.GetSessionTimestamp(id); var data = SharedSessionServerManager.GetData(ids[1], ids[0], timestamp); }
/// <summary> /// Adds a new session-state item to the data store. /// </summary> /// <param name="context">The current request context</param> /// <param name="id">The System.Web.SessionState.HttpSessionState.SessionID for the current request.</param> /// <param name="timeout">The timeout for the current request</param> public override void CreateUninitializedItem(HttpContext context, string id, int timeout) { var ids = SharedSessionIDManager.GetSessionIdAndServer(id); if (ids == null || ids.Length != 3) { throw new ArgumentException("Invalid ID", "id"); } var timestamp = SharedSessionIDManager.GetSessionTimestamp(id); SharedSessionServerManager.SetData(ids[1], ids[0], string.Empty, timestamp); }
/// <summary> /// Returns read-only session-state data from the session data store. /// </summary> /// <param name="context">The current request context</param> /// <param name="id">The session id</param> /// <param name="locked">Indicates if the item is locked in the data store (always false)</param> /// <param name="lockAge">Indicates the age of the lock (always TimeSpan.MaxValue)</param> /// <param name="lockId">An object that represents the lock ID</param> /// <param name="actions">Actions to perform after the request (always SessionStateActions.None)</param> /// <returns></returns> public override SessionStateStoreData GetItem( HttpContext context, string id, out bool locked, out TimeSpan lockAge, out object lockId, out SessionStateActions actions) { var ids = SharedSessionIDManager.GetSessionIdAndServer(id); var timestamp = SharedSessionIDManager.GetSessionTimestamp(id); var data = SharedSessionServerManager.GetData(ids[1], ids[0], timestamp); locked = false; lockAge = TimeSpan.MaxValue; lockId = new Object(); actions = SessionStateActions.None; return(Deserialize(context, data.Data, data.TimeOut)); }