I am trying to add some code to the asax file that will run when an error occurs. My problem is that on some errors it goes into this loop that will send me continual emails. I had 1313 the last time I stopped it. How could I fix this?
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim Message As String = Server.GetLastError().ToString()
Dim mail As New MailMessage()
mail.From = "automated@am1st.com"
mail.To = "webchecker@am1st.com"
mail.Subject = "Site Error"
mail.Body = Message
mail.BodyFormat = MailFormat.Html
SmtpMail.Send(mail)
Server.ClearError()
Response.Redirect("errpage.aspx"
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim Message As String = Server.GetLastError().ToString()
Dim mail As New MailMessage()
mail.From = "automated@am1st.com"
mail.To = "webchecker@am1st.com"
mail.Subject = "Site Error"
mail.Body = Message
mail.BodyFormat = MailFormat.Html
SmtpMail.Send(mail)
Server.ClearError()
Response.Redirect("errpage.aspx"
End Sub