Skip to content

Commit f44e861

Browse files
author
Tiago Brenck
committed
Added missing error page in UI project
1 parent fa13c76 commit f44e861

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@page
2+
@model Microsoft.Identity.Web.UI.Areas.MicrosoftIdentity.Pages.Account.ErrorModel
3+
@{
4+
ViewData["Title"] = "Error";
5+
}
6+
7+
<h1 class="text-danger">Error.</h1>
8+
<h2 class="text-danger">An error occurred while processing your request.</h2>
9+
10+
@if (Model.ShowRequestId)
11+
{
12+
<p>
13+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
14+
</p>
15+
}
16+
17+
<h3>Development Mode</h3>
18+
<p>
19+
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
20+
</p>
21+
<p>
22+
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
23+
</p>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using Microsoft.AspNetCore.Authorization;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.AspNetCore.Mvc.RazorPages;
4+
using System.Diagnostics;
5+
6+
namespace Microsoft.Identity.Web.UI.Areas.MicrosoftIdentity.Pages.Account
7+
{
8+
[AllowAnonymous]
9+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
10+
public class ErrorModel : PageModel
11+
{
12+
/// <summary>
13+
/// This API supports infrastructure and is not intended to be used
14+
/// directly from your code.This API may change or be removed in future releases
15+
/// </summary>
16+
public string RequestId { get; set; }
17+
18+
/// <summary>
19+
/// This API supports infrastructure and is not intended to be used
20+
/// directly from your code.This API may change or be removed in future releases
21+
/// </summary>
22+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
23+
24+
/// <summary>
25+
/// This API supports infrastructure and is not intended to be used
26+
/// directly from your code.This API may change or be removed in future releases
27+
/// </summary>
28+
public void OnGet()
29+
{
30+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)