Custom error page even when Sitefinity cannot load.
Hello,
I am working on getting custom error pages implemented for our Sitefinity project.
I have added the following in my web config:
<
httpErrors
errorMode
=
"Custom"
defaultPath
=
"/Error/Error.htm"
defaultResponseMode
=
"ExecuteURL"
>
<
remove
statusCode
=
"404"
subStatusCode
=
"-1"
/>
<
error
statusCode
=
"404"
prefixLanguageFilePath
=
""
path
=
"/NotFound"
responseMode
=
"ExecuteURL"
/>
</
httpErrors
>
<
customErrors
mode
=
"On"
defaultRedirect
=
"Error/Error.htm"
>
</
customErrors
>
I hate to "bump" a post this way, but I really need an answer for this. Has anyone encountered this before?
Hi,
Could it be that IIS is catching the error and it does not reach to Sitefinity at all. Please see the attached video showing how to set the custom error redirection properly from IIS, and do not hesitate to get back to us if any issues persist.
Kind regards,
Boyan Barnev
the Telerik team
Boyan,
Thanks for answering. However, I get a 404 error when I try to view the video you attached. Could you please check your link?
Thanks!
Hi Adam,
I apologize for the inconvenience, please find the video re uploaded and attached tot his response.
All the best,
Boyan Barnev
the Telerik team
Boyan,
Thanks for providing the video. It handles 90% of all error cases, the problem I was facing was more complicated. The standard setup outlined in the video, and countless articles, works well enough in the common case that a single page has something has something wrong, but the site as a whole is still functioning.
The case I am dealing with is when the entire Sitefinity application has broken down. This is easy enough to replicate if Sitefinity is on a separate machine from its database. Just sever the connection to the database, and the entire app falls apart. As a test, I placed a simple .jpg in the root directory. When the database was down, I could not even browse the .jpg. Any call to the site resulted in a "yellow screen of death". It appears that Sitefinity routes all requests, even static content like images and html files.
This is tragic in the case of the custom error page, which is under the site directory. In the moment that it is needed most, it cannot be served. I had already taken the step of creating a static custom error page as html, so that it would not rely on Sitefinity for rendering, as my dynamic 404 page does. However, there were still a few more steps required.
<
httpErrors
errorMode
=
"Custom"
defaultPath
=
"Error\Error.htm"
defaultResponseMode
=
"File"
existingResponse
=
"Replace"
>
<
remove
statusCode
=
"500"
subStatusCode
=
"-1"
/>
<
remove
statusCode
=
"404"
subStatusCode
=
"-1"
/>
<
error
statusCode
=
"404"
prefixLanguageFilePath
=
""
path
=
"/NotFound"
responseMode
=
"ExecuteURL"
/>
<
error
statusCode
=
"500"
prefixLanguageFilePath
=
""
path
=
"Error\Error.htm"
responseMode
=
"File"
/>
</
httpErrors
>
<
customErrors
mode
=
"On"
defaultRedirect
=
"Error/Error.htm"
>
</
customErrors
>
Thanks Adam, It works.
Initially it was not working but as I removed [defaultPath="Error\Error.htm" ] from "httpErrors " tag ,which you mentioned above, I got SF page for 404 error and html page 500 error as expected.
Please mark as asnswered to you post.
Thanks
Thanks Adam