Answer
Filters plug into the MVC and Razor Pages lifecycle at well-defined points.
Common use cases:
- Authorization checks.
- Logging and diagnostics.
- Caching and response shaping.
- Exception handling and error translation.
- Pre/post action logic such as measuring execution time.