I have 2 attributes that I use within the controllers of my MVC application. AttributeA extends System.Web.Mvc.AuthorizeAttribute and AttributeB extends System.Web.Mvc.ActionFilterAttribute. I want AttributeB to always be run first.
I have tried all possible combinations of Order based on this article, but AttributeA is always run before AttributeB. Can anyone help?
If you look at the System.Web.Mvc.ControllerActionInvoker.InvokeAction
method with reflector you will see that all filters implementing IAuthorizationFilter are invoked before attributes deriving from ActionFilterAttribute and that's because authorization is made before invoking the action.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With