Community discussion forum

Error Capture

  • 2 months ago

     

     

    Hi Everybody

                              How to error capture through email using asp.net 2005

                                        thanks in advance

    Rgds

    Anu

                       

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 2 months ago

    Hi,

    I think the solution will depend on what you are wanting to error capture.

    for example, there is an on error property of the page object, so you can trap the errors that have happened in a web page.  however, that doesnt help if you are wanting to capture errors in web services or when an callback has failed etc.

    I have in the past, taken to having a list that holds a custom class allowing me to describe the details of the error.  That way when an error occurs, i can add a new item to the list and at the end of the process, i generate an email and send them all along to myself and our cs team.

    If you want code to generate an email, i can happily provide that.

    Regards

    Simon C

  • 2 months ago

     

     

     Hi

      I can't understand for ur explaination . I want code to generate an email .

                   Thanka in advance

     

    Rgds

    Anu

  • 2 months ago

    Whenever the error u need to capture that and send to e-mail. if this is your scenario . then this is the solution...

    Import the System.Net.Mail inside  

    Global.asax - File..

    There will be Application_OnError - Event

    In that event.

    VB.Net Code

    Dim mailMsg as new MailMessage 

    Dim smtp as new SmtpClient 

    mailMsg.From = Assing

    mailMsg.To = Assing

    mailMsg.Subject = Assing

    mailMsg.Body = Application.GetLastError().ToString()

    smtp.Host = new SmtpClient(SmtpServerName)

    smtp.Send(mailMsg)

     

     

     

     

  • 2 months ago

    Hi,

    Thanks for posting the code, the only thing i would add is if you want to send this to an external address, you will need to add credentials support in.

    [CODE]

    smtp.Credentials = New Net.NetworkCredential(UserName, Password)

    [/CODE]

    Regards

    Simon C

Post a reply

Enter your message below

Sign in or Join us (it's free).