-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make error response and actual 500 http status
- Loading branch information
1 parent
80de6d6
commit 2a7a451
Showing
6 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\75441ed1\d5440aaf\App_Web_all.generated.cs.8f9494c4.z-ucklgj.dll | ||
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\75441ed1\d5440aaf\App_Web_all.generated.cs.8f9494c4.9mgasjtp.dll |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<%@ Application Inherits="Umbraco.Web.UmbracoApplication" Language="C#" %> | ||
<%@ Application Inherits="AchmeErrorSite.SiteApplication" Language="C#" %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Web; | ||
using Umbraco.Web; | ||
|
||
namespace AchmeErrorSite | ||
{ | ||
public class SiteApplication : UmbracoApplication | ||
{ | ||
protected new void Application_Error(object sender, EventArgs e) | ||
{ | ||
// This method is triggered twice when an exception occurs. | ||
// Only do anything if there is actually an error. | ||
// Otherwise just ignore it. | ||
|
||
Exception lastError = Server.GetLastError(); | ||
|
||
if (lastError != null) | ||
{ | ||
base.Application_Error(sender, e); | ||
} | ||
|
||
if (Context.IsCustomErrorEnabled) | ||
{ | ||
if (lastError != null) | ||
{ | ||
var httpException = lastError as HttpException ?? new HttpException(500, "Internal error"); | ||
|
||
var code = httpException.GetHttpCode(); | ||
Response.StatusCode = code; | ||
Server.ClearError(); | ||
Server.Transfer("/500.html"); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters