79743360

Date: 2025-08-22 11:37:11
Score: 0.5
Natty:
Report link

I've fixed with the following:

Added app.UseStatusCodePagesWithRedirects("/error-page/{0}"); to the Program.cs.

Added the page CustomErrorPage.razor with the following content:

@page "/error-page/{StatusCode:int}"

<div>content</div>

@code {
    [Parameter]
    public int StatusCode { get; set; }

    public bool Is404 => StatusCode == 404;
    public string Heading => Is404 ? "Page not found 404" : $"Error {StatusCode}";
}
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: SDG6