Action Filter Exception

I want to apply an action filter to every action except one. How can I go for it?

For example, suppose I want to apply an authorization filter to every action, except for an action that allows the user to log in.

Thanks in advance.

+4
source share
2 answers

As with asp.net mvc 3, you can now apply conditional filters by implementing the IFilterProvider interface . You can find a good example almost exactly what you want on the Phil Haack blog .

+2
source

I would apply an action filter globally in the Global.asax file, but I will create a filter to accept a parameter to deactivate it. I would apply a filter to an action where I don't want it, and give it a deactivation parameter.

0
source

All Articles