Error.cshtml.cs 620 B

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