mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
Made error pages actually return the correct status codes.
This commit is contained in:
parent
654f684c78
commit
af77b43890
@ -15,7 +15,6 @@ namespace Teknik
|
||||
public static void RegisterRoutes(RouteCollection routes)
|
||||
{
|
||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
||||
routes.IgnoreRoute("{*favicon}", new { favicon = ".*/favicon\\.ico" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,10 @@ namespace Teknik.Areas.Error.Controllers
|
||||
ViewBag.Description = "Just a boring 'ol exception. Nothing to see here, move along.";
|
||||
|
||||
if (Response != null)
|
||||
Response.StatusCode = 200;
|
||||
{
|
||||
Response.StatusCode = 500;
|
||||
Response.TrySkipIisCustomErrors = true;
|
||||
}
|
||||
|
||||
ErrorViewModel model = new ErrorViewModel();
|
||||
model.Exception = exception;
|
||||
@ -34,6 +37,12 @@ namespace Teknik.Areas.Error.Controllers
|
||||
ViewBag.Title = "Http Exception - " + Config.Title;
|
||||
ViewBag.Description = "There has been a Http exception. Run!";
|
||||
|
||||
if (Response != null)
|
||||
{
|
||||
Response.StatusCode = 500;
|
||||
Response.TrySkipIisCustomErrors = true;
|
||||
}
|
||||
|
||||
ErrorViewModel model = new ErrorViewModel();
|
||||
model.Description = exception.Message;
|
||||
model.Exception = exception;
|
||||
@ -48,6 +57,12 @@ namespace Teknik.Areas.Error.Controllers
|
||||
ViewBag.Title = "403 - " + Config.Title;
|
||||
ViewBag.Description = "Access Denied";
|
||||
|
||||
if (Response != null)
|
||||
{
|
||||
Response.StatusCode = 403;
|
||||
Response.TrySkipIisCustomErrors = true;
|
||||
}
|
||||
|
||||
ErrorViewModel model = new ErrorViewModel();
|
||||
model.Exception = exception;
|
||||
|
||||
@ -61,6 +76,12 @@ namespace Teknik.Areas.Error.Controllers
|
||||
ViewBag.Title = "404 - " + Config.Title;
|
||||
ViewBag.Description = "Uh Oh, can't find it!";
|
||||
|
||||
if (Response != null)
|
||||
{
|
||||
Response.StatusCode = 404;
|
||||
Response.TrySkipIisCustomErrors = true;
|
||||
}
|
||||
|
||||
ErrorViewModel model = new ErrorViewModel();
|
||||
model.Exception = exception;
|
||||
|
||||
@ -74,6 +95,12 @@ namespace Teknik.Areas.Error.Controllers
|
||||
ViewBag.Title = "500 - " + Config.Title;
|
||||
ViewBag.Description = "Something Borked";
|
||||
|
||||
if (Response != null)
|
||||
{
|
||||
Response.StatusCode = 500;
|
||||
Response.TrySkipIisCustomErrors = true;
|
||||
}
|
||||
|
||||
ErrorViewModel model = new ErrorViewModel();
|
||||
model.Exception = exception;
|
||||
|
||||
|
@ -52,6 +52,7 @@
|
||||
<add name="strict-transport-security" value="max-age=31536000; includeSubdomains" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
<httpErrors errorMode="Detailed" />
|
||||
</system.webServer>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
|
Loading…
Reference in New Issue
Block a user