By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,319 Members | 1,963 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,319 IT Pros & Developers. It's quick & easy.

Send email when error occurs

P: n/a
Hi,

My plan is to use Try Catch statements to catch an error and then email it
to myself. I send the user to a custom error page and I would like to email
myself the asp.net error. I thought that I would just call a function to
send a mail in the Catch area of the Try Catch statement but it didn't work,
or maybe I just had it set up wrong. What is the best way to accoplish this
task, using a Try Catch or something else?

Thanks.
Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
JV
Configuring your SMTP server may be the problem. It can be complicated.
And, there are sometimes errors created by unexpected software interactions.
I chased around quite awhile before I uncovered the fact that McAfee's
antivirus program was blocking my SMTP port for example.

I would recommend that you examine closely the error being generated when
your code tries to do the email send.

"Andy G" <aj*****@iastate.edu> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...
Hi,

My plan is to use Try Catch statements to catch an error and then email it
to myself. I send the user to a custom error page and I would like to
email myself the asp.net error. I thought that I would just call a
function to send a mail in the Catch area of the Try Catch statement but
it didn't work, or maybe I just had it set up wrong. What is the best way
to accoplish this task, using a Try Catch or something else?

Thanks.

Nov 19 '05 #2

P: n/a
I can send emails fine. The system already generates a number of automatic
emails. I just need to know where to catch the error that occurs and then
send that error to to myself. I apoligize, I know I wasn't clear before.
When I say 'Error', I am talking about ANY error that might occur in the
system when a user is using it. I want to be notified right away of what is
going on.

Hopefully that helps out.
"JV" <jo**********@goisc.com> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
Configuring your SMTP server may be the problem. It can be complicated.
And, there are sometimes errors created by unexpected software
interactions. I chased around quite awhile before I uncovered the fact
that McAfee's antivirus program was blocking my SMTP port for example.

I would recommend that you examine closely the error being generated when
your code tries to do the email send.

"Andy G" <aj*****@iastate.edu> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...
Hi,

My plan is to use Try Catch statements to catch an error and then email
it to myself. I send the user to a custom error page and I would like to
email myself the asp.net error. I thought that I would just call a
function to send a mail in the Catch area of the Try Catch statement but
it didn't work, or maybe I just had it set up wrong. What is the best
way to accoplish this task, using a Try Catch or something else?

Thanks.


Nov 19 '05 #3

P: n/a
Did you see an error message that might indicate what the problem is?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 18 Mar 2005 08:51:20 -0600, "Andy G" <aj*****@iastate.edu>
wrote:
Hi,

My plan is to use Try Catch statements to catch an error and then email it
to myself. I send the user to a custom error page and I would like to email
myself the asp.net error. I thought that I would just call a function to
send a mail in the Catch area of the Try Catch statement but it didn't work,
or maybe I just had it set up wrong. What is the best way to accoplish this
task, using a Try Catch or something else?

Thanks.


Nov 19 '05 #4

P: n/a
Ah! In that case, you'll want to look at using the Application_Error
method in global.asax. This method fires when the HttpApplication
object raises an Error event.

There are some good articles around the topic of error logging using
Application_Error demonstrating how to get the last exception,
emailing a stack trace, etc.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 18 Mar 2005 09:14:29 -0600, "Andy G" <aj*****@iastate.edu>
wrote:
I can send emails fine. The system already generates a number of automatic
emails. I just need to know where to catch the error that occurs and then
send that error to to myself. I apoligize, I know I wasn't clear before.
When I say 'Error', I am talking about ANY error that might occur in the
system when a user is using it. I want to be notified right away of what is
going on.

Hopefully that helps out.
"JV" <jo**********@goisc.com> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
Configuring your SMTP server may be the problem. It can be complicated.
And, there are sometimes errors created by unexpected software
interactions. I chased around quite awhile before I uncovered the fact
that McAfee's antivirus program was blocking my SMTP port for example.

I would recommend that you examine closely the error being generated when
your code tries to do the email send.

"Andy G" <aj*****@iastate.edu> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...
Hi,

My plan is to use Try Catch statements to catch an error and then email
it to myself. I send the user to a custom error page and I would like to
email myself the asp.net error. I thought that I would just call a
function to send a mail in the Catch area of the Try Catch statement but
it didn't work, or maybe I just had it set up wrong. What is the best
way to accoplish this task, using a Try Catch or something else?

Thanks.



Nov 19 '05 #5

P: n/a
Thanks Scott, I will look for some articles on the Application_Error.
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:pg********************************@4ax.com...
Ah! In that case, you'll want to look at using the Application_Error
method in global.asax. This method fires when the HttpApplication
object raises an Error event.

There are some good articles around the topic of error logging using
Application_Error demonstrating how to get the last exception,
emailing a stack trace, etc.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 18 Mar 2005 09:14:29 -0600, "Andy G" <aj*****@iastate.edu>
wrote:
I can send emails fine. The system already generates a number of
automatic
emails. I just need to know where to catch the error that occurs and then
send that error to to myself. I apoligize, I know I wasn't clear before.
When I say 'Error', I am talking about ANY error that might occur in the
system when a user is using it. I want to be notified right away of what
is
going on.

Hopefully that helps out.
"JV" <jo**********@goisc.com> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
Configuring your SMTP server may be the problem. It can be complicated.
And, there are sometimes errors created by unexpected software
interactions. I chased around quite awhile before I uncovered the fact
that McAfee's antivirus program was blocking my SMTP port for example.

I would recommend that you examine closely the error being generated
when
your code tries to do the email send.

"Andy G" <aj*****@iastate.edu> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...
Hi,

My plan is to use Try Catch statements to catch an error and then email
it to myself. I send the user to a custom error page and I would like
to
email myself the asp.net error. I thought that I would just call a
function to send a mail in the Catch area of the Try Catch statement
but
it didn't work, or maybe I just had it set up wrong. What is the best
way to accoplish this task, using a Try Catch or something else?

Thanks.

Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.