public override void OnAuthorization(System.Web.Mvc.AuthorizationContext filterContext) { MyFormsPrincipal <UserInfo> .TrySetUserInfo(HttpContext.Current); if (!filterContext.HttpContext.Request.IsAuthenticated) { filterContext.Result = new RedirectResult("/Home/Login"); } else { var baseContorller = filterContext.Controller as BaseController; baseContorller.CurrentUser = DepositHelper.GetAsync <UsersExtend>(RedisKeyManager.LoginUserInfo((HttpContext.Current.User as MyFormsPrincipal <UserInfo>).UserData.Id.ToString()));; } base.OnAuthorization(filterContext); }
protected void Application_AuthenticateRequest(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; MyFormsPrincipal <WebUserInfo> .TrySetUserInfo(app.Context); }