public void OnAuthorization(AuthorizationContext filterContext) { if (filterContext == null) { throw new ArgumentNullException(nameof(filterContext)); } if (this._doNotValidate) { return; } if (!SystemConst.EnableAdminAuth) { return; } var sysContext = InstanceManger.GetCurrentWebContext(); if (!sysContext.IsAdminUserLogined) { if (filterContext.RequestContext.HttpContext.Request.IsAjaxRequest()) { filterContext.Result = new JsonResult { Data = new { IsSuccess = false, ReturnMsg = "未登录" } }; } else { filterContext.Result = new RedirectResult("/admin/login"); } } }
void Application_Start(object sender, EventArgs e) { BaseDbInstanceManger.RegisterType(); InstanceManger.RegisterType(); // 在应用程序启动时运行的代码 BaseDatabaseConfig.SetDbInfo(); AutoMapConfig.CreateMaps(); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); RouteConfig.RegisterRoutes(RouteTable.Routes); }
public LayUiAdminLoginController() { _adminUserInfoService = new AdminUserInfoService(); _currentWebContext = InstanceManger.GetCurrentWebContext();; }
public AdminHomeController() { _currentWebContext = InstanceManger.GetCurrentWebContext(); }
public LayUiSystemController() { _currentWebContext = InstanceManger.GetCurrentWebContext(); _adminUserInfoService = new AdminUserInfoService(); }