Rework page errors

This commit is contained in:
Laura Hausmann 2022-11-26 13:47:14 +01:00
parent f18811741c
commit 4ea6a19cf6
Signed by: zotan
GPG key ID: D044E84C5BE01605
3 changed files with 10 additions and 12 deletions

View file

@ -32,6 +32,8 @@ if (!app.Environment.IsDevelopment()) {
var provider = new FileExtensionContentTypeProvider { Mappings = { [".gpg"] = "application/pgp-signature" } };
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider });
app.UseStatusCodePagesWithReExecute("/ErrorPages/{0}");
app.UseSession();
app.UseRouting();
app.UseAuthorization();
@ -39,4 +41,4 @@ app.UseAuthorization();
app.MapRazorPages();
app.MapControllers();
app.Run();
app.Run();

View file

@ -12,14 +12,3 @@
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

View file

@ -0,0 +1,7 @@
@page
@{
ViewData["Title"] = "error_404";
}
<h1 class="text-danger">Not found.</h1>
<p>The page you requested does not exist on this server.</p>