我想我明白了。
请随时进行改进并重新发布:
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]public class ARQAuthorize : AuthorizeAttribute{ protected override bool AuthorizeCore(HttpContextbase httpContext) { bool allowToUse = false; IPrincipal user = httpContext.User; if (!user.Identity.IsAuthenticated) { return false; } else{ try {Arq.Core.DAL.ArqContext c = new ArqContext();if (c.Users.Where(u => u.UserName.ToUpper() == user.Identity.Name.ToUpper()).FirstOrDefault().role.RoleDescription == "ADMINS"){ allowToUse = true;} } catch (Exception) { allowToUse = false; } }return allowToUse; }}


