views:

36

answers:

2

does a action filter override a controller filter?

A: 

Considering that they are attributes applied on different targets (class and method) it depends entirely on implementation of the filter. If you don't use any custom logic both should be applied one after the other I think.

Branislav Abadjimarinov
+1  A: 

A filter applied to a controller is just shorthand for applying it to every action method.

So filters in general do not override each other. You can order the filters such that one filter runs after another and reverses the change made by the other one, but in general this is not a good idea.

It's best to write your filters such that they are unaware of each other as much as possible. Having the filters interact with each other is a recipe for adding unnecessary complexity and a source of bugs.

Filters in general should be cross-cutting concerns.

Haacked