asp.net core mvc ActionFilterAttribute 获取自动定义Attribute
public class AgreeAuthorizeAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext context) { //转换ActionDescriptor var controllerActionDescriptor = context.ActionDescriptor as ControllerActionDescriptor; var actionName = controllerActionDescriptor.ActionName; var controllerName = controllerActionDescriptor.ControllerName; var allowAgree = controllerActionDescriptor.MethodInfo .GetCustomAttributes(typeof(AnonymousAgreeAttribute), false).FirstOrDefault(); } }