SessionStateStoreData GetStoreData(HttpContext context, string sessionId, bool isReadOnly) { SessionStateStoreData item; item = (isReadOnly) ? handler.GetItem(context, sessionId, out storeLocked, out storeLockAge, out storeLockId, out storeSessionAction) : handler.GetItemExclusive(context, sessionId, out storeLocked, out storeLockAge, out storeLockId, out storeSessionAction); if (storeLockId == null) { storeLockId = 0; } return(item); }
void GetStoreData(HttpContext context, string sessionId, bool isReadOnly) { storeData = (isReadOnly) ? handler.GetItem(context, sessionId, out storeLocked, out storeLockAge, out storeLockId, out storeSessionAction) : handler.GetItemExclusive(context, sessionId, out storeLocked, out storeLockAge, out storeLockId, out storeSessionAction); if (storeLockId == null) { storeLockId = 0; } }
/// <summary> /// Checks the provider. /// </summary> private static void CheckProvider(SessionStateStoreProviderBase provider) { bool locked; TimeSpan lockAge; object lockId; SessionStateActions actions; provider.InitializeRequest(HttpContext); provider.CreateUninitializedItem(HttpContext, Id, 42); var data = provider.GetItem(HttpContext, Id, out locked, out lockAge, out lockId, out actions); Assert.IsNotNull(data); Assert.AreEqual(42, data.Timeout); Assert.IsFalse(locked); Assert.AreEqual(TimeSpan.Zero, lockAge); Assert.IsNull(lockId); Assert.AreEqual(SessionStateActions.None, actions); provider.ResetItemTimeout(HttpContext, Id); provider.EndRequest(HttpContext); provider.Dispose(); }
/// <summary> /// Checks item expiration. /// </summary> private static void CheckExpiry(SessionStateStoreProviderBase provider) { bool locked; TimeSpan lockAge; object lockId; SessionStateActions actions; // Check that item is present. var res = provider.GetItem(HttpContext, Id, out locked, out lockAge, out lockId, out actions); Assert.IsNotNull(res); // Wait a minute and check again. Thread.Sleep(TimeSpan.FromMinutes(1.05)); res = provider.GetItem(HttpContext, Id, out locked, out lockAge, out lockId, out actions); Assert.IsNull(res); }