aboutsummaryrefslogtreecommitdiffstats
path: root/src/Pages/Errors/Index.cshtml.cs
blob: 05e405d883e97ea2ec77522837dd980ab8916e11 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System;
using System.Net;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace VSH.Pages.Errors;

public class Index : PageModel
{
	public HttpStatusCode ErrorStatusCode { get; set; }

	public void OnGet() {
		try {
			if (int.TryParse(RouteData.Values["code"]?.ToString(), out var status))
				ErrorStatusCode = (HttpStatusCode)status;
		} catch (Exception e) {
			Console.WriteLine(e);
		}
	}
}