From bfb36cac7c36a04d877876a1cbcc471ede08f1ea Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 4 Feb 2013 16:10:43 -0100 Subject: [PATCH] U4-1441 - fix issue with IIS taking over custom errors --- src/Umbraco.Web/Mvc/RenderRouteHandler.cs | 7 +++++-- src/Umbraco.Web/UmbracoModule.cs | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index 3f3e368cbe..39bf65160a 100644 --- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs @@ -334,8 +334,11 @@ namespace Umbraco.Web.Mvc requestContext.HttpContext.Response.Redirect(publishedContentRequest.RedirectUrl, true); return null; } - if (publishedContentRequest.Is404) // should always be the case - requestContext.HttpContext.Response.StatusCode = 404; + if (publishedContentRequest.Is404) // should always be the case + { + requestContext.HttpContext.Response.StatusCode = 404; + requestContext.HttpContext.Response.TrySkipIisCustomErrors = true; + } var handler = GetHandlerOnMissingTemplate(publishedContentRequest); // if it's not null it can be either the PublishedContentNotFoundHandler (no document was diff --git a/src/Umbraco.Web/UmbracoModule.cs b/src/Umbraco.Web/UmbracoModule.cs index 6509c478dd..a6abe152b9 100644 --- a/src/Umbraco.Web/UmbracoModule.cs +++ b/src/Umbraco.Web/UmbracoModule.cs @@ -115,8 +115,11 @@ namespace Umbraco.Web httpContext.Response.Redirect(pcr.RedirectUrl, true); return; } - if (pcr.Is404) - httpContext.Response.StatusCode = 404; + if (pcr.Is404) + { + httpContext.Response.StatusCode = 404; + httpContext.Response.TrySkipIisCustomErrors = true; + } if (!pcr.HasPublishedContent) httpContext.RemapHandler(new PublishedContentNotFoundHandler()); else