December 2019
Intermediate to advanced
510 pages
11h 33m
English
In general, filters can be implemented by extending the built-in types provided by ASP.NET Core. Let's walk through a simple declaration of a custom action filter:
using Microsoft.AspNetCore.Mvc.Filters;namespace SampleAPI.Filters{ public class CustomActionFilter : IActionFilter { public void OnActionExecuting(ActionExecutingContext context) { // do something before the action executes } public void OnActionExecuted(ActionExecutedContext context) { // do something after the action executes } }}
The CustomActionFilter class implements the IActionFilter interface type, which offers two different methods:
Read now
Unlock full access