开发者

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.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜