Another exception occurred while executing the custom error page
In Sitefinity 7.0, I'm having trouble creating a custom error page with redirectMode="ResponseRewrite".
<customErrors mode="RemoteOnly" redirectMode="ResponseRewrite" defaultRedirect="~/Error/500.html"><error statusCode="500" redirect="~/Error/500.html" /></customErrors>
It works perfectly fine without the Rewrite mode, but redirecting is unacceptable. When I use Rewrite, I get the following error message: "An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated."
I am testing my 500 error by throwing an Exception from a Form. I have a custom MyFormsControl object, which inherits from the built-in Telerik.SitefinityModules.Forms.Web.UI.FormsControl. I have tried to throw the Exception both from the IntializeControls method and a BeforeFormSave event handler. I have confirmed in the server event log and the Sitefinity Error log that the only exception is the test exception that I'm throwing, so I don't know why it says that another occurred.
What should I do differently?
Are you passing any information to the server with the form you are testing? Have you tried with a simple user control on a page to see if it will behave the same way? Also can you provide the stack trace of the unwanted exception?
No, I am not passing any information to the server. (E.g., My first test involves throwing the exception during InitializeControls, which executes during initial form display, prior to any submission/postback attempt.)
Also, the unwanted exception does not appear in the event log, so I cannot get a stack trace. The IIS response to my web browser simply tells me that there was an another exception while executing the custom error page for the first exception.