public override void OnActionExecuting(ActionExecutingContext filterContext) { BasicAuthentication auth; switch (type) { default: auth = new DeviceAuthentication(); break; } if (!auth.Authenticated(filterContext.HttpContext.Request)) { filterContext.Result = new HttpUnauthorizedResult(); } base.OnActionExecuting(filterContext); }
public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext) { BasicAuthentication auth; switch (type) { default: auth = new DeviceAuthentication(); break; } if (!auth.Authenticated(actionContext.Request)) { actionContext.Response = new HttpResponseMessage(HttpStatusCode.Unauthorized); var log = LogManager.GetLogger(GetType()); log.Info("HttpStatusCode.Unauthorized"); } base.OnActionExecuting(actionContext); }