So, what are the use cases for middleware? As discussed earlier, they are usually related to cross-cutting concerns such as logging, authentication, and exception handling. ASP.NET Core itself provides some built-in middleware that represents a standard way to solve problems:
- UseStaticFiles(): Provides a way to deal with static files and assets inside your application. When the client asks for a static resource, this middleware filters the request and returns the requested file without hitting the rest of the pipeline.
- AddResponseCaching(): Helps developers to configure the caching system of the application. This middleware also adds all HTTP-compliant information related to the cache.
- UseHttpsRedirection(): This new, built-in piece of ASP.NET Core 2.1 middleware provides a way to force HTTPS redirection.
- UseDeveloperExceptionPage(): This shows...