void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
Exception objErr = new Exception();
objErr = Server.GetLastError().GetBaseException();
StringBuilder strMailtext = new StringBuilder();
strMailtext.Append("Page URL: " + Request.Url.ToString() + "<br>");
strMailtext.Append("Error Source: " + objErr.Source + "<br>");
strMailtext.Append("Error Description: " + objErr.Message + "<br>");
strMailtext.Append("Stack Trace: " + objErr.StackTrace + "<br>");
MailingUtility objMail = new MailingUtility();
objMail.SetFromAddress("enquiries@sherforceplus.net");
objMail.SetFromWhom("Shergroup Security");
objMail.SetToAddress("a-kumar@sherforce.net");
objMail.SetCCAddress("");
objMail.SetMessageBody(strMailtext.ToString());
objMail.SetSmtpClient("shermail");
objMail.SendMail("", false);
}