ActionFilterAttribute is an abstract class upon which action filters are based. It allows the creation of custom action filters.
There are 4 methods that a custom action filter that implements ActionFilterAttribute can override:
OnActionExecuting
OnActionExecuted
OnResultExecuting
OnResultExecuted
Example of custom action filter
I created a simple custom action filter. The purpose of this filter is to clear a portion or the entire content of the cache once a particular controller action is hit.
I added 2 properties, ClearAll to clear the entire content of the cache and Key, to clear a specific key/value from the cache.
This is the simple implementation that I wrote for the cache provider: