Error.cshtml.cs 616 B

123456789101112131415161718192021222324
  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. namespace CSCoreRedis.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. }