Rework page errors (again)
This commit is contained in:
parent
4ea6a19cf6
commit
09587b0dba
|
@ -32,7 +32,7 @@ if (!app.Environment.IsDevelopment()) {
|
||||||
var provider = new FileExtensionContentTypeProvider { Mappings = { [".gpg"] = "application/pgp-signature" } };
|
var provider = new FileExtensionContentTypeProvider { Mappings = { [".gpg"] = "application/pgp-signature" } };
|
||||||
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider });
|
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider });
|
||||||
|
|
||||||
app.UseStatusCodePagesWithReExecute("/ErrorPages/{0}");
|
app.UseStatusCodePagesWithReExecute("/error");
|
||||||
|
|
||||||
app.UseSession();
|
app.UseSession();
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
@page
|
@page
|
||||||
|
@using Microsoft.AspNetCore.WebUtilities
|
||||||
@model ErrorModel
|
@model ErrorModel
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "error";
|
ViewData["Title"] = $"error_{Response.StatusCode}";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1 class="text-danger">Error.</h1>
|
@if (Response.StatusCode == 200) {
|
||||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
<h1>No error occured.</h1>
|
||||||
|
<p>Why are you here?</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
<h1>Error @Response.StatusCode: @ReasonPhrases.GetReasonPhrase(Response.StatusCode)</h1>
|
||||||
|
if (Response.StatusCode == 404) {
|
||||||
|
<p>The page you requested does not exist on this server.</p>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
<p>An error occurred while processing your request.</p>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@if (Model.ShowRequestId) {
|
@if (Model.ShowRequestId) {
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
@page
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "error_404";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h1 class="text-danger">Not found.</h1>
|
|
||||||
<p>The page you requested does not exist on this server.</p>
|
|
|
@ -26,6 +26,10 @@
|
||||||
<None Remove="database.db"/>
|
<None Remove="database.db"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<_ContentIncludedByDefault Remove="Pages\ErrorPages\404.cshtml"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="SetSourceRevisionId" BeforeTargets="InitializeSourceControlInformation">
|
<Target Name="SetSourceRevisionId" BeforeTargets="InitializeSourceControlInformation">
|
||||||
<Exec Command="git describe --long --always --dirty --exclude=* --abbrev=8" ConsoleToMSBuild="True" IgnoreExitCode="False">
|
<Exec Command="git describe --long --always --dirty --exclude=* --abbrev=8" ConsoleToMSBuild="True" IgnoreExitCode="False">
|
||||||
<Output PropertyName="SourceRevisionId" TaskParameter="ConsoleOutput"/>
|
<Output PropertyName="SourceRevisionId" TaskParameter="ConsoleOutput"/>
|
||||||
|
|
Loading…
Reference in a new issue