Updated error page
Updated web.config Updated README.md
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# XFox111.NET
|
# XFox111.NET
|
||||||

|
[](https://xfox111.net)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||

|

|
||||||
|
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user