I have error 400 and 404 pages that I have created and want to use it for my application. I have declared this in my Startup.cs:
app.UseStatusCodePages(async context => {
if(context.HttpContext.Response.StatusCode == 400)
{
context.HttpContext.Response.Redirect("~/Views/Shared/Errors/AccessDenied.cshtml");
}
});
app.UseStatusCodePages(async context => {
if (context.HttpContext.Response.StatusCode == 404)
{
context.HttpContext.Response.Redirect("~/Views/Shared/Errors/NotFound.cshtml");
}
});
Is this correct? When I tested it, I still get redirected back to the standard .net core error page.Am I missing something else?