Instead of overriding AuthorizeAttribute
, did you think you were using your own? You can create your attribute and process the logic for validation.
Something like this:
public class AuthorizeRolesAttribute : ActionFilterAttribute { public UserProfileRole[] Roles { get; set; } public override void OnActionExecuting(ActionExecutingContext filterContext) { var profile = ((ETMembershipUser)Membership.GetUser()).Profile; if (profile != null) { foreach (UserProfileRole role in Roles) { if (role == profile.Role) return; } }
source share