From 8157b9c7225218d33c5a3a087a1855317e02d96d Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Fri, 24 Feb 2012 10:56:28 -0800 Subject: [PATCH] Prevent IIS 7 classic mode from handling custom error/not found page --HG-- branch : 1.x --- src/Orchard/Exceptions/Filters/UnhandledExceptionFilter.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Orchard/Exceptions/Filters/UnhandledExceptionFilter.cs b/src/Orchard/Exceptions/Filters/UnhandledExceptionFilter.cs index f9adf1563..a4a30b072 100644 --- a/src/Orchard/Exceptions/Filters/UnhandledExceptionFilter.cs +++ b/src/Orchard/Exceptions/Filters/UnhandledExceptionFilter.cs @@ -55,6 +55,9 @@ namespace Orchard.Exceptions.Filters { else { filterContext.Result = new ShapeResult(filterContext.Controller, shape); filterContext.RequestContext.HttpContext.Response.StatusCode = 500; + + // prevent IIS 7.0 classic mode from handling the 404/500 itself + filterContext.RequestContext.HttpContext.Response.TrySkipIisCustomErrors = true; } } } @@ -76,6 +79,9 @@ namespace Orchard.Exceptions.Filters { filterContext.Result = new ShapeResult(filterContext.Controller, model); filterContext.RequestContext.HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound; + + // prevent IIS 7.0 classic mode from handling the 404/500 itself + filterContext.RequestContext.HttpContext.Response.TrySkipIisCustomErrors = true; } } }