U4-1081 - treat missing template at 404

This commit is contained in:
Stephan
2012-10-29 12:35:39 -01:00
parent f9aa4b28af
commit be3f95610b
7 changed files with 157 additions and 105 deletions

View File

@@ -7,6 +7,16 @@ namespace Umbraco.Web.Routing
/// </summary>
internal class PublishedContentNotFoundHandler : IHttpHandler
{
string _message;
public PublishedContentNotFoundHandler()
{ }
public PublishedContentNotFoundHandler(string message)
{
_message = message;
}
public void ProcessRequest(HttpContext context)
{
WriteOutput(context);
@@ -28,7 +38,9 @@ namespace Umbraco.Web.Routing
response.Write("<html><body><h1>Page not found</h1>");
response.Write("<h3>");
response.Write(string.Format(reason, HttpUtility.HtmlEncode(UmbracoContext.Current.OriginalRequestUrl)));
response.Write("</h3");
response.Write("</h3>");
if (!string.IsNullOrWhiteSpace(_message))
response.Write("<p>" + _message + "</p>");
response.Write("<p>This page can be replaced with a custom 404. Check the documentation for \"custom 404\".</p>");
response.Write("<p style=\"border-top: 1px solid #ccc; padding-top: 10px\"><small>This page is intentionally left ugly ;-)</small></p>");
response.Write("</body></html>");
@@ -38,7 +50,7 @@ namespace Umbraco.Web.Routing
public bool IsReusable
{
get { return true; }
get { return false; }
}
}
}