filter
Code that runs before or after a controller action to handle a concern such as validation, logging or authorization for selected actions.
In more detail
ASP.NET Core has several kinds, including authorization, action, exception and result filters. Use filters for concerns tied to endpoints and middleware for concerns that apply to the whole application.
Related terms
- endpoint filter — Code that wraps selected minimal API handlers to run checks, such as validation or timing, before or after the handler.
- controller — In ASP.NET Core, a class deriving from ControllerBase that groups related HTTP endpoints as methods called actions.
- cross-cutting concern — A need that applies across many services or endpoints, such as authentication, rate limiting, logging or TLS, rather than to one feature.
Taught in
- Building Routes with Controllers — Modern .NET Core, C# & Enterprise Microservices
- Building Routes with Minimal APIs — Modern .NET Core, C# & Enterprise Microservices
- Comparing Controllers and Minimal APIs — Modern .NET Core, C# & Enterprise Microservices