Create custom exception handler using Elmah and C#.
public static class ElmahCustomLog
{
public static void HandleError(Exception ex, String customMsg)
{
Exception newEx = new Exception(customMsg, ex);
Elmah.ErrorSignal.FromCurrentContext().Raise(newEx);
}
}
public GeneralException(string exceptionMessage, [Optional]string developerComments,[Optional] Exception exceptionforElmah):
base(exceptionMessage)
{
General general = new General();// class for sending custom emails to the admin
exceptionMessage = developerComments != null ? exceptionMessage + "<br/> <b>Comments:</b><br/>" + developerComments :
exceptionMessage;
general.SendErrorMessage(exceptionMessage);
ElmahCustomLog.HandleError(exceptionforElmah, exceptionMessage);
}