Getting more detailed errors

Discussion in 'ASP .Net' started by darrel, Jun 10, 2005.

  1. darrel

    darrel Guest

    I have a question below about an error I am getting:

    Exception has been thrown by the target of an invocation.

    Is there anyway to get asp.net to give me more details than the above? My
    catch statement is as such:

    Catch exc As system.Exception
    div_updateLog.Visible = true
    lbl_updateLog.text = exc.Message
    End Try

    -Darrel
     
    darrel, Jun 10, 2005
    #1
    1. Advertising

  2. In the applications I develop I catch any exception in the Global_Error event handler in the Global.asax file. Basically I use

    Request.FilePath to get the name of the file where the error was thrown
    Server.GetLastError.InnerException this is actually the detailed exception you might be looking for .. i find this property extremely useful
    Server.GetLastError.StackTrace you get the sequence of procedures executed that lead to the exception
    Server.MachineName the server name where the exception ocurred, you can skip this but in my case i have both a development and production server and this property allows me to tell if I caused the exception when developing or the exception was thrown by a user
    Request.ServerVariables("HTTP_USER_AGENT") the client browser information ... very useful if you want to create statistics about who mess with your app
    Request.ServerVariables("REMOTE_ADDR") the client IP adress where the error ocurred... if you are in an intranet it is useful but if you app is public then you probably are behind a firewall and you will get the firewall IP adress.

    I create a report email for every exception. Play around with them and try several ways to catch and handle exceptions

    Hope this helps
    Alan Ferrandiz Langley
    geekswithblogs.com/aferrandiz




    "darrel" <> escribió en el mensaje news:...
    >I have a question below about an error I am getting:
    >
    > Exception has been thrown by the target of an invocation.
    >
    > Is there anyway to get asp.net to give me more details than the above? My
    > catch statement is as such:
    >
    > Catch exc As system.Exception
    > div_updateLog.Visible = true
    > lbl_updateLog.text = exc.Message
    > End Try
    >
    > -Darrel
    >
    >
     
    Alan Ferrandiz Langley [MCT], Jun 11, 2005
    #2
    1. Advertising

  3. darrel

    darrel Guest

    > In the applications I develop I catch any exception in the Global_Error
    > event handler in the Global.asax file. Basically I use


    Alan:

    That's a very thorough list. Thank you!

    -Darrel
     
    darrel, Jun 13, 2005
    #3
    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. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    960
    Mark Goldin
    Jan 17, 2004
  2. Ben Harper
    Replies:
    2
    Views:
    463
    Ben Harper
    Jul 5, 2005
  3. Michael
    Replies:
    4
    Views:
    417
    Matt Hammond
    Jun 26, 2006
  4. Simon  Willison
    Replies:
    8
    Views:
    289
    John J. Lee
    Oct 3, 2006
  5. Robbie Hatley

    How do I get more-detailed directory info?

    Robbie Hatley, Sep 26, 2005, in forum: Perl Misc
    Replies:
    12
    Views:
    248
    Paul Lalli
    Oct 3, 2005
Loading...

Share This Page