Skip to content

Commit 1f57837

Browse files
authored
Improve error-page recovery navigation to prevent dead ends (#1103)
1 parent 6dd3364 commit 1f57837

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

EssentialCSharp.Web.Tests/FunctionalTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,10 @@ public async Task WhenTheApplicationStarts_NonExistingPage_GivesCorrectStatusCod
5151
using HttpResponseMessage response = await client.GetAsync("/non-existing-page1234");
5252

5353
await Assert.That(response.StatusCode).IsEqualTo(HttpStatusCode.NotFound);
54+
55+
string content = await response.Content.ReadAsStringAsync();
56+
await Assert.That(content).Contains("Go Home");
57+
await Assert.That(content).Contains("Go Back");
58+
await Assert.That(content).Contains("Browse Chapters");
5459
}
55-
}
60+
}

EssentialCSharp.Web/Views/Home/Error.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
}
1717
<div class="d-flex gap-2">
1818
<a href="/home" class="btn btn-primary">Go Home</a>
19+
<a href="/hello-world" class="btn btn-outline-primary">Browse Chapters</a>
1920
<button type="button" class="btn btn-secondary"
2021
onclick="if(history.length > 1){ history.back(); } else { window.location='/home'; }">
2122
Go Back

0 commit comments

Comments
 (0)