Kategorie

Action Filters

Filters in ASP.NET Core allow code to be run before or after specific stages in the request processing pipeline.

Built-in filters handle tasks such as:

  • Authorization (preventing access to resources a user isn't authorized for).
  • Response caching (short-circuiting the request pipeline to return a cached response).

More about Action Filters here

We will create ActionFilter that will log simple message. 

 

Then register it globally.

context object contains information about used controller, so you can build conditionals for your filters.

 

 

back to top