2023-09-03 15:30:53 +02:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
2023-09-06 21:06:13 +02:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2023-09-03 15:30:53 +02:00
|
|
|
|
|
2023-09-06 21:06:13 +02:00
|
|
|
|
namespace SharpRSS.Blazor.Pages
|
2023-09-03 15:30:53 +02:00
|
|
|
|
{
|
2023-09-06 21:06:13 +02:00
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
|
|
|
[IgnoreAntiforgeryToken]
|
|
|
|
|
public class ErrorModel : PageModel
|
|
|
|
|
{
|
|
|
|
|
public string? RequestId { get; set; }
|
2023-09-03 15:30:53 +02:00
|
|
|
|
|
2023-09-06 21:06:13 +02:00
|
|
|
|
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
2023-09-03 15:30:53 +02:00
|
|
|
|
|
2023-09-06 21:06:13 +02:00
|
|
|
|
private readonly ILogger<ErrorModel> _logger;
|
2023-09-03 15:30:53 +02:00
|
|
|
|
|
2023-09-06 21:06:13 +02:00
|
|
|
|
public ErrorModel(ILogger<ErrorModel> logger)
|
|
|
|
|
{
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
2023-09-03 15:30:53 +02:00
|
|
|
|
|
2023-09-06 21:06:13 +02:00
|
|
|
|
public void OnGet()
|
|
|
|
|
{
|
|
|
|
|
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
|
|
|
|
}
|
2023-09-03 15:30:53 +02:00
|
|
|
|
}
|
|
|
|
|
}
|