summaryrefslogtreecommitdiff
path: root/CoreWiki/Pages/Error.cshtml.cs
diff options
context:
space:
mode:
authorPaweł Bernaciak <pawelbernaciak@zohomail.eu>2023-02-10 16:19:46 +0100
committerPaweł Bernaciak <pawelbernaciak@zohomail.eu>2023-02-10 16:19:46 +0100
commit00c3b32e2db200a2f42396ac7f8381704ec97268 (patch)
tree089d68dcbda127d4c95ccca9b0c9a18b59dc8bdc /CoreWiki/Pages/Error.cshtml.cs
Initial Commit
Diffstat (limited to 'CoreWiki/Pages/Error.cshtml.cs')
-rw-r--r--CoreWiki/Pages/Error.cshtml.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/CoreWiki/Pages/Error.cshtml.cs b/CoreWiki/Pages/Error.cshtml.cs
new file mode 100644
index 0000000..8f88dd5
--- /dev/null
+++ b/CoreWiki/Pages/Error.cshtml.cs
@@ -0,0 +1,26 @@
+using System.Diagnostics;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+
+namespace CoreWiki.Pages;
+
+[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
+[IgnoreAntiforgeryToken]
+public class ErrorModel : PageModel
+{
+ public string? RequestId { get; set; }
+
+ public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
+
+ private readonly ILogger<ErrorModel> _logger;
+
+ public ErrorModel(ILogger<ErrorModel> logger)
+ {
+ _logger = logger;
+ }
+
+ public void OnGet()
+ {
+ RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
+ }
+} \ No newline at end of file