Emailing Errors from Pages

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

I am trying to get my "Global.asax" error handling event to email me
an error description. I believe I have the SMTP code correct and
pointing it to my company's Exchange Server. I still fail to get my
"localhost" installation of my app to send emails. I have checked in
MMC to see that the Default SMTP server is running on my box. I have
not entered any configs into that.

Any tips?

Brian

Here is what I have coded in Global.asax :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
' Brian
' 04/14/2004
Try
Mail.SmtpMail.SmtpServer = "our.exchange.server"
Dim mlMessage As Mail.MailMessage = New Mail.MailMessage
mlMessage.Body =
HttpContext.Current.Server.GetLastError().ToString()
mlMessage.To = "(e-mail address removed)"
mlMessage.From = "WebUser"
mlMessage.Subject = "Error"
Call Mail.SmtpMail.Send(mlMessage)

Catch ERR As System.Exception
' Just ignore it at this point.
End Try
End Sub
 
Error occurs at line :
Call Mail.SmtpMail.Send(mlMessage)

And is phrased :
System.Web.HttpException: Could not access 'CDO.Message' object.

Alvin Bruney said:
what is the error

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Brian said:
I am trying to get my "Global.asax" error handling event to email me
an error description. I believe I have the SMTP code correct and
pointing it to my company's Exchange Server. I still fail to get my
"localhost" installation of my app to send emails. I have checked in
MMC to see that the Default SMTP server is running on my box. I have
not entered any configs into that.

Any tips?

Brian

Here is what I have coded in Global.asax :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
' Brian
' 04/14/2004
Try
Mail.SmtpMail.SmtpServer = "our.exchange.server"
Dim mlMessage As Mail.MailMessage = New Mail.MailMessage
mlMessage.Body =
HttpContext.Current.Server.GetLastError().ToString()
mlMessage.To = "(e-mail address removed)"
mlMessage.From = "WebUser"
mlMessage.Subject = "Error"
Call Mail.SmtpMail.Send(mlMessage)

Catch ERR As System.Exception
' Just ignore it at this point.
End Try
End Sub
 
please make sure you have the cdo dll installed on the server. if it is, you
will need to re-register it at the command line using the regsvr32 utility

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Brian said:
Error occurs at line :
Call Mail.SmtpMail.Send(mlMessage)

And is phrased :
System.Web.HttpException: Could not access 'CDO.Message' object.

Alvin Bruney said:
what is the error

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Brian said:
I am trying to get my "Global.asax" error handling event to email me
an error description. I believe I have the SMTP code correct and
pointing it to my company's Exchange Server. I still fail to get my
"localhost" installation of my app to send emails. I have checked in
MMC to see that the Default SMTP server is running on my box. I have
not entered any configs into that.

Any tips?

Brian

Here is what I have coded in Global.asax :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
' Brian
' 04/14/2004
Try
Mail.SmtpMail.SmtpServer = "our.exchange.server"
Dim mlMessage As Mail.MailMessage = New Mail.MailMessage
mlMessage.Body =
HttpContext.Current.Server.GetLastError().ToString()
mlMessage.To = "(e-mail address removed)"
mlMessage.From = "WebUser"
mlMessage.Subject = "Error"
Call Mail.SmtpMail.Send(mlMessage)

Catch ERR As System.Exception
' Just ignore it at this point.
End Try
End Sub
 
Check the InnerException and InnerException's InnerException property. They
can be nested two or three deep. The innermost exception has the actual
error message that caused the problem.

Eric


Brian said:
Error occurs at line :
Call Mail.SmtpMail.Send(mlMessage)

And is phrased :
System.Web.HttpException: Could not access 'CDO.Message' object.

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
what is the error

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Brian said:
I am trying to get my "Global.asax" error handling event to email me
an error description. I believe I have the SMTP code correct and
pointing it to my company's Exchange Server. I still fail to get my
"localhost" installation of my app to send emails. I have checked in
MMC to see that the Default SMTP server is running on my box. I have
not entered any configs into that.

Any tips?

Brian

Here is what I have coded in Global.asax :
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
' Brian
' 04/14/2004
Try
Mail.SmtpMail.SmtpServer = "our.exchange.server"
Dim mlMessage As Mail.MailMessage = New Mail.MailMessage
mlMessage.Body =
HttpContext.Current.Server.GetLastError().ToString()
mlMessage.To = "(e-mail address removed)"
mlMessage.From = "WebUser"
mlMessage.Subject = "Error"
Call Mail.SmtpMail.Send(mlMessage)

Catch ERR As System.Exception
' Just ignore it at this point.
End Try
End Sub
 
Back
Top