Blazor's route handling received significant improvements in .NET 10. The new `NotFoundPage` parameter on the `Router` component lets you specify a dedicated Razor component for 404 pages, replacing the previously broken `NotFound` render fragment. A custom `NotFoundContext` service can be registered to pass contextual headings and messages to the 404 page, enabling both generic and product-specific error messages. Combined with `NavigationManager.NotFound()` and `OnNotFound` (introduced in .NET 9), developers can trigger proper HTTP 404 responses with custom content. Additionally, .NET 10 allows inheriting from `NavLink` to write custom URL-matching logic, fixing the long-standing issue where active link highlighting was lost when navigating to child routes or URLs with query strings.
Table of contents
Understanding the Handling of Not Found Routes in BlazorThe Problem with Not Found Pages Before .NET 10Features in .NET 10 for Route ManagementConclusionSort: