This project is read-only.

Custom Error Pages - 500 and 404

Topics: Customizing Orchard, Troubleshooting
Dec 11, 2012 at 4:33 PM
Edited Dec 11, 2012 at 10:10 PM



For our Orchard project (Orchard 1.6), we would like to set up some error pages for both 404 and 500 errors. To do this, we created both the NotFound.cshtml and ErrorPage.cshtml in our Theme/Views directory. The interesting thing is that our custom NotFound.cshtml is loaded when we have a 404 error, but when we try to simulate a 500 error, we only see the standard ASP.NET "yellow screen". We have changed the "<customErrors>" mode to any of the 3 settings ("On", "Off", and "RemoteOnly") and have yet to see our custom 500 error page. 


Related parts of our web.config file: 


    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="WarmupHttpModule" />
      <add name="WarmupHttpModule" type="Orchard.WarmupStarter.WarmupHttpModule, Orchard.WarmupStarter, Version=1.0.20, Culture=neutral"/>
    <handlers accessPolicy="Script">
      <!-- clear all handlers, prevents executing code file extensions, prevents returning any file contents -->
      <!-- Return 404 for all requests via managed handler. The url routing handler will substitute the mvc request handler when routes match. -->
      <add name="NotFound" path="*" verb="*" type="System.Web.HttpNotFoundHandler" preCondition="integratedMode" requireAccess="Script"/>
    <!-- Prevent IIS 7.0 from returning a custom 404/500 error page of its own -->
    <httpErrors existingResponse="PassThrough" />


Is there anything in the web.config file we need to add? Any IIS server settings? Anything we need to add to the web.config file of our theme? Thanks in advance.


Edit: We went ahead and installed the Vandelay Industries module and enabled the "Fail" module which allows for testing of our custom error pages. When going to "/fail", we do see our custom error page. When we generate our own 500 error, however, we are still seeing the ASP.NET "yellow screen". 


Edit #2: We have decided to stray away from the Orchard 500 error page and went with our own static page that is directed to from a 500 error (setup through the web.config).