简体   繁体   中英

ActionFilterAttribute for the controller?

after having applied the very same action filter to all the actions of a controller, I wonder if there is a controller filter so that I can apply it to the class and avoid declaring it for every action.

I've tried to solve the problem applying the attribute to the controller constructor, but not being an action it fails to compile.

you can apply directly to the class

namespace somenamespace.Controllers {
    [somenamespace.HelpersClass.ActionFilters.SomeControllerFilter]
    public  class SomeController : Controller {
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM