Ejemplo n.º 1
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            object[] objAllowedAnonymousArray =
                filterContext.ActionDescriptor.GetCustomAttributes(typeof(AllowedAnonymous), false);
            if (objAllowedAnonymousArray.Length > 0)
            {
                return;
            }

            UserContext = SessionContainer.GetUserContext(HttpContext) as ShellUserContext;

            if (UserContext == null)
            {
                //返回登录超时的消息
            }
        }
Ejemplo n.º 2
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            object[] objAllowedAnonymousArray =
                filterContext.ActionDescriptor.GetCustomAttributes(typeof(AllowedAnonymous), false);
            if (objAllowedAnonymousArray.Length > 0)
            {
                return;
            }

            UserContext = SessionContainer.GetUserContext(HttpContext) as ShellUserContext;

            if (UserContext == null)
            {
                //重定向到登录页面
                filterContext.Result = new RedirectResult("/Home/Login");
                return;
            }

            ViewBag.UserContext = UserContext;
        }
Ejemplo n.º 3
0
        public static bool Verify(string key, HttpContext httpContext)
        {
            ShellUserContext userContext = (ShellUserContext)SessionContainer.GetUserContext(httpContext);

            return(userContext.AuthorizationKeyVerify(key));
        }