diff --git a/Backend/Startup.cs b/Backend/Startup.cs index 663e4a8..a6d4c5e 100644 --- a/Backend/Startup.cs +++ b/Backend/Startup.cs @@ -32,7 +32,7 @@ if (!app.Environment.IsDevelopment()) { var provider = new FileExtensionContentTypeProvider { Mappings = { [".gpg"] = "application/pgp-signature" } }; app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider }); -app.UseStatusCodePagesWithReExecute("/ErrorPages/{0}"); +app.UseStatusCodePagesWithReExecute("/error"); app.UseSession(); app.UseRouting(); diff --git a/Pages/Error.cshtml b/Pages/Error.cshtml index 5e0abe5..f9e3a88 100644 --- a/Pages/Error.cshtml +++ b/Pages/Error.cshtml @@ -1,11 +1,24 @@ @page +@using Microsoft.AspNetCore.WebUtilities @model ErrorModel @{ - ViewData["Title"] = "error"; + ViewData["Title"] = $"error_{Response.StatusCode}"; } -

Error.

-

An error occurred while processing your request.

+@if (Response.StatusCode == 200) { +

No error occured.

+

Why are you here?

+} + +else { +

Error @Response.StatusCode: @ReasonPhrases.GetReasonPhrase(Response.StatusCode)

+ if (Response.StatusCode == 404) { +

The page you requested does not exist on this server.

+ } + else { +

An error occurred while processing your request.

+ } +} @if (Model.ShowRequestId) {

diff --git a/Pages/ErrorPages/404.cshtml b/Pages/ErrorPages/404.cshtml deleted file mode 100644 index 1e2079f..0000000 --- a/Pages/ErrorPages/404.cshtml +++ /dev/null @@ -1,7 +0,0 @@ -@page -@{ - ViewData["Title"] = "error_404"; -} - -

Not found.

-

The page you requested does not exist on this server.

diff --git a/zotan.pw-web.csproj b/zotan.pw-web.csproj index e38af5f..4c2ec9c 100644 --- a/zotan.pw-web.csproj +++ b/zotan.pw-web.csproj @@ -26,6 +26,10 @@ + + <_ContentIncludedByDefault Remove="Pages\ErrorPages\404.cshtml"/> + +