I've looked around a bit and there seem to be numerous work-arounds to get error handling handling in previous versions of EPIServer but I'm wondering what the proper thing to do with CMS 6 is.
We'ere using IIS 7 and I've turned on customErrors in the asp.net web.config, but I don't seem to be able to get my custom error pages for the friendly urls.
Is there clear guidance available for this?
I don't know of a definitive guide, but what I think might help you is to put <httpErrors existingResponse="PassThrough" /> inside your system.webserver element in web.config.
Let me know if that helps (I just might include it in a guide ;-)).
Thanks for the reply.
Setting that didn't seem to change anything. Is this possibly a bug with the friendly urls?
If I have a 500 error or if I type enter a url like http://localhost:8888/noPageHere.aspx, then the customErrors settings are respected.
If I have a "friendly" url like this http://localhost:8888/no/page/here/ doesn't seem to get handled in the main site. It does get handled if the path is under the admin UI path; http://localhost:8888/admin/no/page/here/ give the "Incorrect Link" "page".
Thanks to support, I now know that the issue was IIS; I didn't have a required attribute set in the httpErrors section of the web.config.
One must specify errorMode="Custom".
In order to still send a 404 status, the Error_404 page sets Response.StatusCode = 404 in the page load
<httpErrors errorMode="Custom" existingResponse="Replace"> <remove statusCode="404" subStatusCode="0" /> <error statusCode="404" subStatusCode="0" prefixLanguageFilePath="" path="/ErrorPages/Error_404.aspx" responseMode="ExecuteURL" />
When setting redirectMode to ResponseRewrite it should actually give a status 404 by default since the original response had a 404 and its contents is simply replaced by the 404 page. In other (non-episerver) setups I have seen this work fine. Somehow I am getting 200 in EPiServer. Settings PassThrough to true does not work because then IIS is handling itself and there is no logic set up there.
Ideas how to get a status 404 without settings it hard in the 404 page itself.