/// <summary> /// 登录认证 /// </summary> /// <param name="actionContext"></param> public override void OnActionExecuting(ActionExecutingContext actionContext) { //判断是否匿名访问 bool isAnonymous = ContextUtil.IsDefineAttribute <AllowAnonymousAttribute>(actionContext); if (!isAnonymous) { if (!loginCheck.IsLogined(actionContext)) { //Ajax请求 返回值 if (ContextUtil.IsAjaxRequest(actionContext)) { actionContext.Result = ResultUtil.NoLogin(loginCheck.GetRedirectUrl(actionContext)); } else { actionContext.HttpContext.Response.Redirect(loginCheck.GetRedirectUrl(actionContext)); return; } } } //base.OnActionExecuting(actionContext); }