public override void OnAuthorization(HttpActionContext actionContext) { string url = actionContext.Request.RequestUri.AbsolutePath; string userid = actionContext.RequestContext.Principal.Identity.Name; RoleBasedAuthorization roleauth = new RoleBasedAuthorization(); UserRolePermission result = roleauth.Authorize(userid, url); if (result == null) { throw new Exception("Not Allow to Access!"); } }