asp.net core的授权过滤器中获取action上的Attribute

var action = context.ActionDescriptor as ControllerActionDescriptor;
var permission = action.MethodInfo.GetCustomAttribute<PermissionAttribute>();

大概就是这样。

原文地址:https://www.cnblogs.com/boxrice/p/11798274.html