Posts

Showing posts with the label 404 Page

Custom 404 Error Page Update

Image
  In an earlier publication, I discussed the process for developing and configuring a 404 error page within the Blazor framework. Following the release of .NET 8, the methodology for redirecting to the 404 error page has undergone significant changes. Previously, under versions before .NET 8, configuring the routing for a 404 error page involved appending it within the <NotFound> element of the Router component in the router.razor file. This method is no longer applicable. New Configuration Approach The current procedure necessitates the integration of a middleware service into the application pipeline, specifically within the Program.cs file:              app.UseStatusCodePagesWithRedirects("/CustomErrorPage"); The custom error page must be established as a Razor page, incorporating the @page directive to facilitate its functionality. Upon encountering a "page not found" error, the application will redirect to the "CustomErrorPage". T...