protected override void OnActionExecuting(ActionExecutingContext filterContext) { SessionID = filterContext.RequestContext.HttpContext.Request.Cookies["cydonSessionID"]?.Value ?? string.Empty; SessionCache sessionCache = Cache.GetCache <SessionCache>(); if (filterContext.RequestContext.HttpContext.Request.QueryString.AllKeys.Contains("forceSessionRefresh")) { sessionCache.ForceRefreshSession(SessionID); } SessionCache.CachedSession cachedSession = sessionCache.GetSessionBySessionID(SessionID); object authorizationAttribute = GetType().GetCustomAttributes(typeof(CydonAuthorizationAttribute), true).FirstOrDefault(); if (authorizationAttribute == null) { authorizationAttribute = filterContext.ActionDescriptor.GetCustomAttributes(typeof(CydonAuthorizationAttribute), true).FirstOrDefault(); } if (authorizationAttribute == null) { if (cachedSession != null && cachedSession.Expiration >= DateTime.Now) { UserID = cachedSession.UserID; } return; } if (cachedSession == null || cachedSession.Expiration < DateTime.Now) { string redirect = Config.INSTANCE.UnauthenticatedRedirect + "?redirectUrl=" + Uri.EscapeDataString(filterContext.RequestContext.HttpContext.Request.Url.ToString()); filterContext.Result = Redirect(redirect); return; } UserID = cachedSession.UserID; cachedSession.ResetSessionExpiration(); if (filterContext.Result == null) { PreActionCheck(filterContext, cachedSession); } }