Every request to an ASP.NET Core app flows through a chain of middleware — small components that can inspect, change, or short-circuit the request on the way in and the response on the way out. The order you register them in matters, and getting it right is the difference between an app that behaves predictably and one that quietly breaks authentication or error handling.
This module starts with built-in and custom middleware,
including how ordering works. It then covers filters, which hook
into the MVC action pipeline after a route has been chosen, followed by
global exception handling with custom middleware and
IExceptionHandler, and finishes with structured logging
so you can see what your app is doing in production.
Watch the lessons in order, then continue on to Razor Pages & MVC.
A lesson from Microsoft's back-end .NET for Beginners series on implementing common behavior with middleware. It covers using built-in middleware, writing your own, and why middleware ordering matters.
Covers filters in Web API, including action, resource, and authorization filters, with real-time examples of running code before and after specific stages of request processing.
Two production-ready ways to catch unhandled exceptions in your .NET apps: a custom middleware approach and the IExceptionHandler feature introduced in .NET 8.
A beginner-friendly guide to structured logging in .NET that explains what ILogger is, what Serilog adds on top of it, and how to install and configure it.