Error.cshtml.cs 823 B

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