Filters inherit a different scope based on their initialization in our codebase. In practice, a filter may have three different scopes:
- Global scope: This means that the filter covers the whole MVC pipeline. Every call to a specific MVC route will pass through that filter.
- Controller scope: In this case, the filter is initialized as an attribute in one or multiple controller classes. It will act only on requests that have been directed to the target controllers.
- Action scope: The filter is initialized as an attribute in one or multiple action methods. It will act only on requests that have been directed to the target methods.
It is also essential to understand that filters are executed, depending on the scope, in a ...