How to authorize a set of controllers without placing the annotation on each one?
问题 I have sets of controllers which are each used for each authorization type. For example, a class A authorization will have a set of controllers each which require class A authorization. Is there a way to place one [Authorize(Role="Class A")] attribute somewhere which will apply to each of those controllers without having to decorate each controller with the same attribute? 回答1: You can initialize those controllers derived from your base controller. namely put your attribute on a controller