Error.cshtml.cs 544 B

123456789101112131415161718192021
  1. using Microsoft.AspNetCore.Mvc;
  2. using Microsoft.AspNetCore.Mvc.RazorPages;
  3. using System.Diagnostics;
  4. namespace Admin.Pages
  5. {
  6. [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
  7. [IgnoreAntiforgeryToken]
  8. public class ErrorModel : PageModel
  9. {
  10. public string? RequestId { get; set; }
  11. public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
  12. public void OnGet()
  13. {
  14. RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
  15. }
  16. }
  17. }