Rework page errors
This commit is contained in:
parent
f18811741c
commit
4ea6a19cf6
|
@ -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();
|
||||
|
|
|
@ -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>
|
7
Pages/ErrorPages/404.cshtml
Normal file
7
Pages/ErrorPages/404.cshtml
Normal 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>
|
Loading…
Reference in a new issue