Send email when error occurs

Discussion in 'ASP .Net' started by Andy G, Mar 18, 2005.

  1. Andy G

    Andy G Guest

    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.
    Andy G, Mar 18, 2005
    #1
    1. Advertising

  2. Andy G

    JV Guest

    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" <> wrote in message
    news:...
    > 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.
    >
    JV, Mar 18, 2005
    #2
    1. Advertising

  3. Andy G

    Andy G Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    >> 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.
    >>

    >
    >
    Andy G, Mar 18, 2005
    #3
  4. Andy G

    Scott Allen Guest

    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" <>
    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.
    >
    Scott Allen, Mar 18, 2005
    #4
  5. Andy G

    Scott Allen Guest

    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" <>
    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" <> wrote in message
    >news:...
    >> 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" <> wrote in message
    >> news:...
    >>> 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.
    >>>

    >>
    >>

    >
    Scott Allen, Mar 18, 2005
    #5
  6. Andy G

    Andy G Guest

    Thanks Scott, I will look for some articles on the Application_Error.


    "Scott Allen" <> wrote in message
    news:p...
    > 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" <>
    > 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" <> wrote in message
    >>news:...
    >>> 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" <> wrote in message
    >>> news:...
    >>>> 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.
    >>>>
    >>>
    >>>

    >>

    >
    Andy G, Mar 18, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter
    Replies:
    0
    Views:
    3,356
    Peter
    Jul 1, 2003
  2. Anjan Bhowmik
    Replies:
    0
    Views:
    276
    Anjan Bhowmik
    May 16, 2008
  3. Ivan Vieira

    Send email when a error occurs

    Ivan Vieira, Mar 30, 2007, in forum: Ruby
    Replies:
    2
    Views:
    123
    Brian Candler
    Mar 31, 2007
  4. Geek
    Replies:
    3
    Views:
    145
  5. Replies:
    2
    Views:
    396
    Tintin
    Jan 5, 2007
Loading...

Share This Page