Orchard Custom 404/500/Error Pages

Topics: Core, Customizing Orchard, Troubleshooting
Feb 28, 2012 at 7:13 PM

Does anybody have solid guidance around the proper way to setup just a standard 404 error page to work in Orchard.  A quick search on Google shows several solutions, however all of them seem to have their own problems.  Mainly that you can get Orchard to servce the 404 page fine, however it changes the status code to be a 200.

Both of the following articles give a solution, but have the same problem in that the error pages do not serve the proper HTTP status code for the error.



Our setup has the static error pages served out of the /Media directory so that they can be managed by a content editor without need for deployment. Since they are located here, we actually don't need to setup the StaticFileHandler.

So basically, is their a way to do this properly without writting a new StaticFileHandler that also returns the appropriate response code?

Feb 28, 2012 at 7:51 PM

If you are using 1.x, you should just create a page Error.cshtml or NotFound.cshtml in your template.

Mar 1, 2012 at 9:04 PM

Are you saying if I create an Error.cshtml and NotFound.cshtml in the /Views directory of my theme Orchard will automatically route to those locations on a 500/404?

Mar 1, 2012 at 9:29 PM

Yes, if you use Orchard 1.4.


http://www.nwazet.com/foobar (404)

http://www.nwazet.com/fail (500)

Mar 1, 2012 at 9:57 PM

We are using 1.3.9 and I created a file called NotFound.cshtml in our custom theme under the \Views directory.  It is still returning the default (blank) 404 response from Orchard instead of serving the partial view with a 404 code.

Mar 1, 2012 at 10:25 PM

As Sébastien said, this works in 1.4.

Jul 3, 2012 at 6:08 PM

I'm getting 500 instead of 404 errors and the default custom error pages are not working nor are the duplicates I made in my theme.

I read somewhere this may have something to do with deploying from VSDWS to IIS7 rather than from local IIS7 to production IIS7.. so my web config is not being set up correctly?

The event logs show the following:

Event code: 4005 Event message: Forms authentication failed for the request. Reason: The ticket supplied was invalid. 


Muchos Gracias Amigos!!!