source: Farmatiko/Pages/Error.cshtml.cs@ ec6ac45

Last change on this file since ec6ac45 was 30a465f, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago

Initial commit

  • Property mode set to 100644
File size: 810 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Diagnostics;
4using System.Linq;
5using System.Threading.Tasks;
6using Microsoft.AspNetCore.Mvc;
7using Microsoft.AspNetCore.Mvc.RazorPages;
8using Microsoft.Extensions.Logging;
9
10namespace Farmatiko.Pages
11{
12 [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
13 public class ErrorModel : PageModel
14 {
15 private readonly ILogger<ErrorModel> _logger;
16
17 public ErrorModel(ILogger<ErrorModel> logger)
18 {
19 _logger = logger;
20 }
21
22 public string RequestId { get; set; }
23
24 public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
25
26 public void OnGet()
27 {
28 RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
29 }
30 }
31}
Note: See TracBrowser for help on using the repository browser.