File size: 1,495 Bytes
3dd5c9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
@page "/Error"
@using System.Diagnostics

<PageTitle>@AppLocalization.Text("error.title", "Error")</PageTitle>

<h1 class="text-danger">@AppLocalization.Text("error.heading", "Error")</h1>
<h2 class="text-danger">@AppLocalization.Text("error.processingRequest", "An error occurred while processing your request.")</h2>

@if (ShowRequestId)
{
    <p>
        <strong>@AppLocalization.Text("error.requestId", "Request ID"):</strong> <code>@RequestId</code>
    </p>
}

<h3>@AppLocalization.Text("error.developmentMode", "Development Mode")</h3>
<p>
    @AppLocalization.Text("error.developmentDetails", "Switching to the Development environment will display more detailed information about the error that occurred.")
</p>
<p>
    <strong>@AppLocalization.Text("error.developmentWarning", "The Development environment should not be enabled for deployed applications.")</strong>
    @AppLocalization.Text("error.developmentSensitive", "It can expose sensitive exception details to end users.")
    @AppLocalization.Text("error.developmentInstructions", "For local debugging, set the ASPNETCORE_ENVIRONMENT environment variable to Development and restart the application.")
</p>

@code{
    [CascadingParameter]
    private HttpContext? HttpContext { get; set; }

    private string? RequestId { get; set; }
    private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

    protected override void OnInitialized() =>
        RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
}