webmusic/Pages/Error.cshtml.cs

16 lines
461 B
C#
Raw Normal View History

using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
2020-12-21 20:42:29 +01:00
namespace webmusic.Pages {
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel {
public string RequestId { get; set; }
2020-12-21 20:42:29 +01:00
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
2020-12-21 20:42:29 +01:00
public void OnGet() {
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}