protected override bool IsAuthorized(System.Web.Http.Controllers.HttpActionContext actionContext) { var terminal = HttpContext.Current.Request.UserHostAddress.IP(); return(ServiceStartup.GetPrimaryAuthorized(terminal) != null); }
/// <summary> /// 请求中添加当前时间,在返回时计算此次请求耗时 /// </summary> public override void OnActionExecuting(HttpActionContext actionContext) { HttpContext.Current.Items.Add("WebKit", DateTime.Now); ServiceStartup.RefreshAuthorized(HttpContext.Current.Request.UserHostAddress); base.OnActionExecuting(actionContext); }