I'm dealing with a small issue here, basically I would like to custom an error page for a specific website. I can handle that without problems for 404 not found pages, but for error 500, I could not find any solution.
Each website has its own design templates, so we would like to have each website its own 500 Error page.
Is there way to accomplish that?
Here is what I have done so far:
I created a SystemEvent Handler this is the code:
/// Summary description for CMSSystemEvents
public partial class CMSModuleLoader
/// Attribute class that ensures the loading of custom handlers
private class CustomSystemEventsAttribute : CMSLoaderAttribute
/// Called automatically when the application starts
public override void Init()
// Assigns custom handlers to the appropriate events
SystemEvents.Exception.Execute += System_Exception_Execute;
private void System_Exception_Execute(object sender, SystemEventArgs e)
// Kentico automatically logs the Exception into kentico logs.
// Nothing to do here.
// We will use the CMS.EmailProvider to send e-mails
EmailMessage email = new EmailMessage();
email.From = "firstname.lastname@example.org";
email.Recipients = "email@example.com;
email.Subject = "Testing";
email.Body = "Error exception";
everything works just find, it sends the email correctly when an exception occurred.
I added these lines to the webconfig:
<httpErrors existingResponse="Auto" errorMode="Custom">
<error statusCode="500" redirect="~/CMSTemplates/SampleSite/Errors/Exception.aspx" />
The issue here is that when I access a demo page that is throwing an exception I got the email, but it did not redirect me to the Exception.aspx template, also how can I code it in a way to handle multiple websites with multiple designs.
I also tried to redirect the user inside the handler right after send the email, but URLHelper and any other way to redirect was not possible.
Any suggestions, ideas are always welcome.
Thanks in advance.