Live Chat Icon For mobile
Live Chat Icon

How do I email a website exception

Platform: ASP.NET| Category: Mail

VB.NET


Protected Sub Application_Error(sender As [Object], e As EventArgs)
   	Dim ex As Exception = Server.GetLastError()
   	Dim mail As New MailMessage()
   	mail.To = 'manag@syncfusion.com'
   	mail.From = 'admin@syncfusion.com'
   	mail.Subject = ex.Message.ToString()
   	mail.Body = ex.ToString()
   	mail.BodyFormat = MailFormat.Html
   	SmtpMail.SmtpServer = 'localhost'
   	SmtpMail.Send(mail)
End Sub ’Application_Error

C#


protected void Application_Error(Object sender, EventArgs e)
{ 
	Exception ex = Server.GetLastError ();
	MailMessage mail = new MailMessage();
	mail.To = 'manag@syncfusion.com';
	mail.From = 'admin@syncfusion.com';
	mail.Subject = ex.Message.ToString ();
	mail.Body =ex.ToString  ();
	mail.BodyFormat = MailFormat.Html;
	SmtpMail.SmtpServer = 'localhost';  
	SmtpMail.Send( mail );
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.