/// <summary> /// set the result,OnAuthenticationChallenge will be invoked, else the action method will be invoked. /// </summary> public void OnAuthentication(AuthenticationContext filterContext) { //AuthenticationContext.Result:设置表示认证质疑的ActionResult if (!LisenceHelper.IsLisenceValid()) { if (filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToLower() == "lisence" && filterContext.ActionDescriptor.ActionName.ToLower() == "exception") { } else { filterContext.Result = new LisenceExceptionResult(); } } }
public LisenceRegistry() { // Schedule a simple job to run at a specific time //每天23:59分刷新Lisence信息 Schedule(() => LisenceHelper.ParseLisence()).ToRunEvery(1).Days().At(23, 59); }