Blazor Custom 404 Error Page
In Blazor, the basic routing is defined in the App.razor file. You can see the part that handles a known page route and assigns it a layout: <Router AppAssembly="@typeof(Program).Assembly"> <Found Context="routeData"> <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> </Found> <NotFound> <LayoutView Layout="@typeof(MainLayout)"> <p>Sorry, there's nothing at this address.</p> </LayoutView> </NotFound> </Router> There is a section, NotFound, that is invoked with the page route is not found. It will apply a layout as well. You can see that when a route is not found it simply say “There’s nothing at this address.” You can see that it is using the default layout as well. What we want to do is make a more presentable message page