Summary
Action filters give us an easy way to keep actions clean. If we find repeating tasks inside our Actions that are not really relevant to the actual responsibility of the Action, we can move those tasks out to an ActionFilter
, or maybe a ModelBinder
or some MiddleWare, depending on how it needs to work globally. The more relevant it is to an Action, the more appropriate it is to use an ActionFilter
.
There are more kinds of filters, all of which work in a similar fashion. To learn more about the different kinds of filters, reading the documentation is definitely recommended.
In the next chapter, we speed up your web application by using caches.