Hi @Diaz, Francisca
ASP.NET Core 5 introduced breaking-change in handling the response status code NotFound 404
. Use ExceptionHandlerOptions.AllowStatusCode404Response property.
To set the AllowStatusCode404Response property, you can use the following code:
app.UseExceptionHandler(new ExceptionHandlerOptions()
{
AllowStatusCode404Response = true,
ExceptionHandlingPath = "/error"
});
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion