示例#1
0
        protected override bool IsAuthorized(System.Web.Http.Controllers.HttpActionContext actionContext)
        {
            var terminal = HttpContext.Current.Request.UserHostAddress.IP();

            return(ServiceStartup.GetPrimaryAuthorized(terminal) != null);
        }
示例#2
0
 /// <summary>
 ///     请求中添加当前时间,在返回时计算此次请求耗时
 /// </summary>
 public override void OnActionExecuting(HttpActionContext actionContext)
 {
     HttpContext.Current.Items.Add("WebKit", DateTime.Now);
     ServiceStartup.RefreshAuthorized(HttpContext.Current.Request.UserHostAddress);
     base.OnActionExecuting(actionContext);
 }