Skip to content

Commit a10494d

Browse files
committed
Add ASP.NET Trace identifier into error page
1 parent ab33aa1 commit a10494d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/JoinRpg.Portal/Controllers/ErrorPageController.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ public IActionResult Error(int statusCode)
2121
return View(
2222
new ErrorViewModel
2323
{
24-
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier,
25-
Path = feature?.RawTarget,
24+
RequestId = Activity.Current?.Id ?? "",
25+
AspNetTrace = HttpContext.TraceIdentifier,
26+
Path = feature?.RawTarget ?? "NO PATH",
2627
}
2728
);
2829
}

src/JoinRpg.Portal/Models/ErrorViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ public class ErrorViewModel
77
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
88

99
public string Path { get; internal set; }
10+
11+
public string AspNetTrace { get; set; }
1012
}
1113
}

src/JoinRpg.Portal/Views/Shared/Error.cshtml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
<p> RequestId: @Model.RequestId </p>
1616
}
1717

18+
@if (Model.AspNetTrace is not null)
19+
{
20+
<p>TraceIdentifier: @Model.AspNetTrace</p>
21+
}
22+
1823
@if (!string.IsNullOrWhiteSpace(Model.Path))
1924
{
2025
<p> Путь: @Model.Path </p>

0 commit comments

Comments
 (0)