Try our conversational search powered by Generative AI!

Definitive config guide for asp.net error pages in EPIServer CMS6

Vote:
 

Hi,

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?

 

Thanks

-A

 

#41661
Jul 19, 2010 20:48
Vote:
 

Hi,

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 ;-)).

#41663
Jul 20, 2010 8:56
Vote:
 

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".

 

-A

 

 

 

#41696
Jul 21, 2010 15:22
Vote:
 

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" />
        </httpErrors>

<httpErrors errorMode="Custom" existingResponse="Replace">            <remove statusCode="404" subStatusCode="0" />            <error statusCode="404" subStatusCode="0" prefixLanguageFilePath="" path="/ErrorPages/Error_404.aspx" responseMode="ExecuteURL" />    

   </httpErrors>

 

#41796
Jul 28, 2010 15:24
Vote:
 

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.

Sandor

#51275
May 31, 2011 11:38
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.