예제 #1
0
        public override void EndRequest(HttpContext context)
        {
            try
            {
                // This check is required for unit tests to work
                int sessionTimeoutInSeconds;
                if (context != null && context.Session != null)
                {
                    sessionTimeoutInSeconds = context.Session.Timeout * FROM_MIN_TO_SEC;
                }
                else
                {
                    sessionTimeoutInSeconds = (int)configuration.SessionTimeout.TotalSeconds;
                }

                if (sessionId != null && sessionLockId != null)
                {
                    GetAccessToStore(sessionId);
                    cache.TryReleaseLockIfLockIdMatch(sessionLockId, sessionTimeoutInSeconds);
                    LogUtility.LogInfo("EndRequest => Session Id: {0}, Session provider object: {1} => Lock Released with lockId {2}.", sessionId, this.GetHashCode(), sessionLockId);
                    sessionId     = null;
                    sessionLockId = null;
                }
                cache = null;
            }
            catch (Exception e)
            {
                LogUtility.LogError("EndRequest => {0}", e.ToString());
                LastException = e;
                if (configuration.ThrowOnError)
                {
                    throw;
                }
            }
        }
예제 #2
0
 public override void EndRequest(HttpContext context)
 {
     try
     {
         if (sessionId != null && sessionLockId != null)
         {
             GetAccessToStore(sessionId);
             cache.TryReleaseLockIfLockIdMatch(sessionLockId);
             LogUtility.LogInfo("EndRequest => Session Id: {0}, Session provider object: {1} => Lock Released with lockId {2}.", sessionId, this.GetHashCode(), sessionLockId);
             sessionId     = null;
             sessionLockId = null;
         }
         cache = null;
     }
     catch (Exception e)
     {
         LogUtility.LogError("EndRequest => {0}", e.ToString());
         LastException = e;
         if (configuration.ThrowOnError)
         {
             throw;
         }
     }
 }