1
0

Updated error page

Updated web.config
Updated README.md
This commit is contained in:
Michael Gordeev
2020-03-30 19:23:07 +03:00
parent e530fc2489
commit f87bac4266
6 changed files with 20 additions and 32 deletions
@@ -1,5 +1,4 @@
using System.Diagnostics; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using MyWebsite.Models.Databases; using MyWebsite.Models.Databases;
using MyWebsite.ViewModels; using MyWebsite.ViewModels;
@@ -28,6 +27,10 @@ namespace MyWebsite.Controllers
[Route("Error")] [Route("Error")]
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() => public IActionResult Error() =>
View(new ErrorViewModel(Database) { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); View();
[Route("GetError")]
public IActionResult GetError(int errorCode = 404) =>
StatusCode(errorCode);
} }
} }
+1
View File
@@ -54,6 +54,7 @@ namespace MyWebsite
app.UseHsts(); app.UseHsts();
} }
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseStatusCodePagesWithReExecute("/Error");
app.UseStaticFiles(); app.UseStaticFiles();
app.UseRouting(); app.UseRouting();
@@ -1,12 +0,0 @@
using MyWebsite.Models.Databases;
namespace MyWebsite.ViewModels
{
public class ErrorViewModel : ViewModelBase
{
public ErrorViewModel(DatabaseContext context) : base(context) { }
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
}
+6 -10
View File
@@ -1,19 +1,15 @@
@model ErrorViewModel @using Microsoft.AspNetCore.WebUtilities
@{ @{
ViewData["Title"] = "Error"; ViewData["Title"] = "Error";
} }
<!-- TODO: Make Error page-->
<header> <header>
<h1>Error</h1> <h1>Error @Context.Response.StatusCode</h1>
<h2>An error occurred while processing your request.</h2> <h2>@ReasonPhrases.GetReasonPhrase(Context.Response.StatusCode)</h2>
</header> </header>
<article> <article>
@if (Model.ShowRequestId) <p>
{
<p> </p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
</article> </article>
+5 -5
View File
@@ -7,25 +7,25 @@
<!--Legacy redirects--> <!--Legacy redirects-->
<rule name="GutSchedule API redirect" stopProcessing="true"> <rule name="GutSchedule API redirect" stopProcessing="true">
<match url="schedule_offset.txt" /> <match url="schedule_offset.txt" />
<action type="Redirect" url="https://xfox111.net/API/GUTSchedule/SemesterOffsetDay" redirectType="Permanent" appendQueryString="false" /> <action type="Redirect" url="/API/GUTSchedule/SemesterOffsetDay" redirectType="Permanent" appendQueryString="false" />
</rule> </rule>
<rule name="GUT.Schedule Privacy policy" stopProcessing="true"> <rule name="GUT.Schedule Privacy policy" stopProcessing="true">
<match url="Projects/GUTSchedule/PrivacyPolicy.txt" /> <match url="Projects/GUTSchedule/PrivacyPolicy.txt" />
<action type="Redirect" url="https://xfox111.net/Projects/GUTSchedule/PrivacyPolicy" redirectType="Permanent" appendQueryString="false" /> <action type="Redirect" url="/Projects/GUTSchedule/PrivacyPolicy" redirectType="Permanent" appendQueryString="false" />
</rule> </rule>
<rule name="GUT.Schedule download page" stopProcessing="true"> <rule name="GUT.Schedule download page" stopProcessing="true">
<match url="guttime/get" /> <match url="guttime/get" />
<action type="Redirect" url="https://xfox111.net/Projects/GUTSchedule" redirectType="Permanent" appendQueryString="false" /> <action type="Redirect" url="/Projects/GUTSchedule" redirectType="Permanent" appendQueryString="false" />
</rule> </rule>
<rule name="FoxTubr Privacy policy" stopProcessing="true"> <rule name="FoxTubr Privacy policy" stopProcessing="true">
<match url="Projects/FoxTube/PrivacyPolicy.txt" /> <match url="Projects/FoxTube/PrivacyPolicy.txt" />
<action type="Redirect" url="https://xfox111.net/Projects/FoxTube/PrivacyPolicy" redirectType="Permanent" appendQueryString="false" /> <action type="Redirect" url="/Projects/FoxTube/PrivacyPolicy" redirectType="Permanent" appendQueryString="false" />
</rule> </rule>
<!--/Legacy redirects--> <!--/Legacy redirects-->
<!--Website maintainence redirect--> <!--Website maintainence redirect-->
<rule name="Construction redirect" stopProcessing="true" enabled="false"> <rule name="Construction redirect" stopProcessing="true" enabled="false">
<match url="^(?!Admin|API|Construction|css|assets|fonts|images)" /> <match url="^(?!Admin|API|Construction|css|assets|fonts|images)" />
<action type="Redirect" url="https://xfox111.net/Construction" redirectType="Temporary" appendQueryString="false" /> <action type="Rewrite" url="/Construction" appendQueryString="false" />
</rule> </rule>
<!--\Website maintainence redirect--> <!--\Website maintainence redirect-->
</rules> </rules>
+2 -2
View File
@@ -1,5 +1,5 @@
# XFox111.NET # XFox111.NET
![Website](https://img.shields.io/website?down_message=offline&label=XFox111.NET&up_message=online&url=https%3A%2F%2Fxfox111.net%2FSiteInfo) [![Website](https://img.shields.io/website?down_color=red&down_message=offline&label=XFox111.NET&up_color=green&up_message=online&url=https%3A%2F%2Fxfox111.net)](https://xfox111.net)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
![GitHub repo size](https://img.shields.io/github/repo-size/xfox111/CVWebsite?label=Repository%20size) ![GitHub repo size](https://img.shields.io/github/repo-size/xfox111/CVWebsite?label=Repository%20size)
@@ -23,4 +23,4 @@ Check out my website on https://xfox111.net/
At the moment this repository **is not intended** to be used as a basement for other personal websites and used to represent my ASP.NET skills. I'll fix this issue later At the moment this repository **is not intended** to be used as a basement for other personal websites and used to represent my ASP.NET skills. I'll fix this issue later
## Copyrights ## Copyrights
> ©2019 Michael "XFox" Gordeev > ©2020 Michael "XFox" Gordeev