♻️ New error page

This commit is contained in:
2025-11-21 23:30:43 +08:00
parent 2a35786204
commit 98b8d5f33b
7 changed files with 141 additions and 109 deletions

View File

@@ -1,4 +1,6 @@
using System.Diagnostics;
using DysonNetwork.Shared.Models;
using DysonNetwork.Zone.Publication;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
@@ -12,8 +14,20 @@ public class ErrorModel : PageModel
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
[FromRoute] public new int? StatusCode { get; set; }
public SnPublicationSite? Site { get; set; }
public string? SiteName { get; set; }
public string? CurrentPath { get; set; }
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
if (HttpContext.Items.TryGetValue(PublicationSiteMiddleware.SiteContextKey, out var site))
Site = site as SnPublicationSite;
SiteName = Request.Headers["X-SiteName"].ToString();
CurrentPath = Request.Path;
}
}