From df9031c47f8e97d8e2df3177093271a458f27267 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 1 May 2023 02:43:32 +0200 Subject: Initial commit --- MatrixRoomUtils.Web.Server/Pages/Error.cshtml | 42 ++++++++++++++++++++++++ MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs | 26 +++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 MatrixRoomUtils.Web.Server/Pages/Error.cshtml create mode 100644 MatrixRoomUtils.Web.Server/Pages/Error.cshtml.cs (limited to 'MatrixRoomUtils.Web.Server/Pages') diff --git a/MatrixRoomUtils.Web.Server/Pages/Error.cshtml b/MatrixRoomUtils.Web.Server/Pages/Error.cshtml new file mode 100644 index 0000000..f5b4396 --- /dev/null +++ b/MatrixRoomUtils.Web.Server/Pages/Error.cshtml @@ -0,0 +1,42 @@ +@page +@model tmp.Server.Pages.ErrorModel + + + + + + + + Error + + + + + +
+
+

Error.

+

An error occurred while processing your request.

+ + @if (Model.ShowRequestId) + { +

+ Request ID: @Model.RequestId +

+ } + +

Development Mode

+

+ Swapping to the Development environment displays detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

+
+
+ + + 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 _logger; + + public ErrorModel(ILogger logger) + { + _logger = logger; + } + + public void OnGet() + { + RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; + } +} -- cgit 1.5.1