Configurable Global Action Filters for ASP.NET MVC
Posted by: K. Scott Allen,
on 18 Jan 2011 |
View original | Bookmarked: 0 time(s)
ASP.NET MVC 3.0 introduces global action filters - an easy way to apply an action filter to every action in an MVC application. All you need to do is register the filters during application startup: protected void Application_Start()
{
...
GlobalFilters.Filters.Add(new HandleErrorAttribute());
GlobalFilters.Filters.Add(new FooFilter());
GlobalFilters.Filters.Add(new BarFilter()); ...
}
But what if you wanted to add (or remove) filters through configuration?
<configSections>
...