Error.cshtml.cs 874 B

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