Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

working with the global.asax file.

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
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
 
Hey I would suggest stepping through your code to see why it is looping. Possibly you have an error on errpage.aspx. If you call the Error function from their and there is an error in would continually email.

Lol sorry but it is kinda funny getting 1313 emails. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Is there a way to request the server error message on errpage.aspx??
 
You could just call the subroutine. I haven't actually used the server error event before.
Put a breakpoint on your errpage pageload and another at the top of the server error event code. See what happens. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top