Пример #1
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            HttpCookie cookie = HttpContext.Current.Request.Cookies["rememberMe"];

            if (cookie != null && AuthenticationService.LoggedUser == null)
            {
                AuthenticationService.AuthenticateByCookie(cookie);
            }

            if (AuthenticationService.LoggedUser == null)
            {
                filterContext.HttpContext.Response.Redirect("~/Account/Login?redirectUrl=" + filterContext.HttpContext.Request.Url);
                filterContext.Result = new EmptyResult();
            }
        }