Sometimes, we may want to perform logic either before an action method is called or after an action method runs. In that case, we use filters, which we will be covering in this recipe.
Filters are basically handlers which encapsulate the common functionality or the cross-cutting concern. We just define them once and then apply them to the different controllers and action methods.