.Net Core 3 Razor pages catching 404

Try to use UseStatusCodePages middleware in .net core. By default, an ASP.NET Core app doesn’t provide a status code page for HTTP status codes, such as 404 – Not Found.

call UseStatusCodePages in the Startup.Configure method:


If you want to redirect to any specific url then use


Explore more about app.UseStatusCodePages() on .Net Core documentations: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/error-handling?view=aspnetcore-3.1

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top