|
|
@ -1,40 +1,40 @@
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
|
|
using System.Diagnostics;
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WF_WebAdmin.Pages
|
|
|
|
namespace WF_WebAdmin.Pages
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
|
|
[IgnoreAntiforgeryToken]
|
|
|
|
[IgnoreAntiforgeryToken]
|
|
|
|
public class ErrorModel : PageModel
|
|
|
|
public class ErrorModel : PageModel
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public string? RequestId { get; set; }
|
|
|
|
public string? RequestId { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
|
|
|
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
|
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<ErrorModel> _logger;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="ErrorModel"/> class.
|
|
|
|
/// Initializes a new instance of the <see cref="ErrorModel"/> class.
|
|
|
|
/// This constructor is used to inject the <see cref="ILogger{ErrorModel}"/> into the model for logging purposes.
|
|
|
|
/// This constructor is used to inject the <see cref="ILogger{ErrorModel}"/> into the model for logging purposes.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="logger">An instance of the <see cref="ILogger{ErrorModel}"/> used for logging error-related information.</param>
|
|
|
|
/// <param name="logger">An instance of the <see cref="ILogger{ErrorModel}"/> used for logging error-related information.</param>
|
|
|
|
public ErrorModel(ILogger<ErrorModel> logger)
|
|
|
|
public ErrorModel(ILogger<ErrorModel> logger)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Handles the GET request for the page or endpoint.
|
|
|
|
/// Handles the GET request for the page or endpoint.
|
|
|
|
/// This method retrieves the request ID for tracing purposes, using the `Activity.Current?.Id`
|
|
|
|
/// This method retrieves the request ID for tracing purposes, using the `Activity.Current?.Id`
|
|
|
|
/// if it's available, or the `HttpContext.TraceIdentifier` as a fallback if no current activity ID is present.
|
|
|
|
/// if it's available, or the `HttpContext.TraceIdentifier` as a fallback if no current activity ID is present.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public void OnGet()
|
|
|
|
public void OnGet()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Retrieve the current request ID for tracing
|
|
|
|
// Retrieve the current request ID for tracing
|
|
|
|
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
|
|
|
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|