about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs')
-rw-r--r--MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs b/MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs
new file mode 100644
index 0000000..5627bf0
--- /dev/null
+++ b/MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs
@@ -0,0 +1,26 @@
+using System.Diagnostics;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.RazorPages;
+
+namespace tmp.Server.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;
+    }
+}