Custom Middleware in ASP.NET
Option #1: Implementing IMiddleware Add the middleware to DI, and then use it. In the middleware class, use DI for the constructor, and implement the single InvokeAsync method. Option #2: By Convention Use the middleware, but you don’t need to register it in DI. In the middleware class constructor, accept and store the RequestDelegate, then […]