This project is read-only.

How to put in a catch all custom error page

Topics: Writing modules
Jun 5, 2013 at 10:18 AM
I'd like to replace all ASP.NET error pages (e.g. someone types <script> in a form and gets the "A potentially dangerous Request.Form value was detected from the client" YSOD) with an Orchard page which still shows the top level navigation. Is that possible?
Jun 6, 2013 at 5:11 PM
I thought including an ErrorPage.cshtml file in your theme folder would take care of this...

Just like including a NotFound.cshtml file catches all 404 errors
Jun 7, 2013 at 11:49 AM
Thanks Philip, good to know. Unfortunately this doesn't work for URL and form validation errors. E.g.
Jun 20, 2013 at 1:44 AM
Ahhh...gotcha, I see what you're talking about.

I don't think there's anything you can do with Orchard to catch would most likely have to be defined within IIS to redirect to a URL. For one of my custom projects, I have a module that has a general error page accessed by ~/Error. I suppose if you just redirected to a page like this from IIS, it would be better than a YSOD...but you probably wouldn't be able to catch any of the actual error message text this way. Just an idea though. I believe all I created for it in my module was a Route, Controller action, and View. I use it for specific authentication errors in the module that I need more than a "you're not authorized" message for.