public override void OnActionExecuting(HttpActionContext actionContext) { base.OnActionExecuting(actionContext); if (!String.IsNullOrEmpty(Roles)) { var Manager = HttpContext.Current.GetOwinContext().Get<UserManager>(); var roles = Roles.Split(','); if (!Manager.Authorize(roles)) { HttpResponseMessage message = new HttpResponseMessage(HttpStatusCode.Redirect); message.Headers.Location = actionContext.GetRedirectUri("/Error/UnauthorizedAccess"); actionContext.Response = message; } } }