Posts

Showing posts from October, 2020

StatusCodePagesMiddleware in ASP.NET Core

Image
StatusCodePagesMiddleware converts raw error status codes into user-friendly error page.  It can be used like this:  app.UseStatusCodePages(); or  app.UseStatusCodePagesWithReExecute("/error/{0}"); StatusCodePagesMiddleware re-executes the pipeline to generate an HTML body for a 4xx/5xx response. For example, if a request to the /Home path returns a 404 response, the pipeline is re-executed using the /error/404 path to generate the HTML response.