ASP.NET MVC ActionFilter Analog for whole controller
Is it possible to inject behavior for whole controller, like it could be d开发者_开发问答one for action with ActionFilterAttribute
Best regards, Alexey Zakarov
I may not understand the question correctly, but I think that you are asking if you can have an action filter attached to the entire class? If so the answer is yes, for example the [Authorize] attribute. (you can obviously create your own.)
The controller can also override the OnActionExecuting/Executed + OnResultExecuting/ OnResultExecuted. (Expand that to inheritance and you can have derived controllers all doing the same thing.)
精彩评论