Live Chat Icon For mobile
Live Chat Icon

How do I email a website exception

Platform: ASP.NET| Category: Mail


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


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

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

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

Please submit your question and answer.