Error.cshtml.cs (661B)
1 using System.Diagnostics; 2 using Microsoft.AspNetCore.Mvc; 3 using Microsoft.AspNetCore.Mvc.RazorPages; 4 5 namespace MatrixRoomUtils.Web.Server.Pages; 6 7 [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 [IgnoreAntiforgeryToken] 9 public class ErrorModel : PageModel 10 { 11 public string? RequestId { get; set; } 12 13 public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 14 15 private readonly ILogger<ErrorModel> _logger; 16 17 public ErrorModel(ILogger<ErrorModel> logger) 18 { 19 _logger = logger; 20 } 21 22 public void OnGet() 23 { 24 RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 25 } 26 }