Error.cshtml.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. #nullable disable
  4. using System.Diagnostics;
  5. using Microsoft.AspNetCore.Authorization;
  6. using Microsoft.AspNetCore.Mvc;
  7. using Microsoft.AspNetCore.Mvc.RazorPages;
  8. namespace bitforum.Areas.Identity.Pages
  9. {
  10. /// <summary>
  11. /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
  12. /// directly from your code. This API may change or be removed in future releases.
  13. /// </summary>
  14. [AllowAnonymous]
  15. [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
  16. public class ErrorModel : PageModel
  17. {
  18. /// <summary>
  19. /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
  20. /// directly from your code. This API may change or be removed in future releases.
  21. /// </summary>
  22. public string RequestId { get; set; }
  23. /// <summary>
  24. /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
  25. /// directly from your code. This API may change or be removed in future releases.
  26. /// </summary>
  27. public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
  28. /// <summary>
  29. /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
  30. /// directly from your code. This API may change or be removed in future releases.
  31. /// </summary>
  32. public void OnGet()
  33. {
  34. RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
  35. }
  36. }
  37. }