© Adam Freeman 2017

Adam Freeman, Pro ASP.NET Core MVC 2, https://doi.org/10.1007/978-1-4842-3150-0_19

19. Filters

Adam Freeman

(1)London, UK

Filters inject extra logic into MVC request processing. They provide a simple and elegant way to implement crosscutting concerns—a term that refers to functionality that is used all over an application and doesn’t fit neatly into any one place, where it would break the separation of concerns. Classic examples of crosscutting concerns are logging, authorization, and caching. In this chapter, I show you the different categories of filters that MVC supports, how to create and use custom filters, and how to control their execution. Table 19-1 puts filters in context.

Table 19-1. Putting Filters in Context

Get Pro ASP.NET Core MVC 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.