Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error Handling

Error Handling

Scheduled Pinned Locked Moved ASP.NET
helpquestiondatabasetutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    braber
    wrote on last edited by
    #1

    Hello all, I have been tasked with implementing an error handling strategy into our web app... I have decided on placing all the event logging and e-mail notification in the application_error event in the global.asax... My problem arises when I generate different types of errors... For example if I place a button on a page that does nothing but throw an error when clicked... I go into the application_error event just fine... On the other had if I place a link on the page with a URL reference to an invalid URL I sometimes (and sometimes not) get into the application_error event handler... I thought maybe there was some other error causing this event to fire... So I guess my question is this: What types of errors or exceptions trigger the application_error event and which ones do not? Thanks all Brandon

    M T 2 Replies Last reply
    0
    • B braber

      Hello all, I have been tasked with implementing an error handling strategy into our web app... I have decided on placing all the event logging and e-mail notification in the application_error event in the global.asax... My problem arises when I generate different types of errors... For example if I place a button on a page that does nothing but throw an error when clicked... I go into the application_error event just fine... On the other had if I place a link on the page with a URL reference to an invalid URL I sometimes (and sometimes not) get into the application_error event handler... I thought maybe there was some other error causing this event to fire... So I guess my question is this: What types of errors or exceptions trigger the application_error event and which ones do not? Thanks all Brandon

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi Brandon. I believe any unhandled exception within an ASP.NET application will bubble up to Application_Error. An invalid URL to say, an .htm page, would be handled by IIS rather than ASP.NET (and therefore you're not seeing Application_Error fired in these situations).

      B 1 Reply Last reply
      0
      • B braber

        Hello all, I have been tasked with implementing an error handling strategy into our web app... I have decided on placing all the event logging and e-mail notification in the application_error event in the global.asax... My problem arises when I generate different types of errors... For example if I place a button on a page that does nothing but throw an error when clicked... I go into the application_error event just fine... On the other had if I place a link on the page with a URL reference to an invalid URL I sometimes (and sometimes not) get into the application_error event handler... I thought maybe there was some other error causing this event to fire... So I guess my question is this: What types of errors or exceptions trigger the application_error event and which ones do not? Thanks all Brandon

        T Offline
        T Offline
        Tiger456
        wrote on last edited by
        #3

        Hai Bradon, Application_Error event is used to track unhandled exceptions. When an unhandled exception occurs + Log the error, so that admin can identify the cause. + Show a friendly message to user.

        1 Reply Last reply
        0
        • M Mike Ellison

          Hi Brandon. I believe any unhandled exception within an ASP.NET application will bubble up to Application_Error. An invalid URL to say, an .htm page, would be handled by IIS rather than ASP.NET (and therefore you're not seeing Application_Error fired in these situations).

          B Offline
          B Offline
          braber
          wrote on last edited by
          #4

          Right, I have been doing the research... It seems that all ASP.NET requests are handled through IIS which get directed to the aspnet_isapi.dll which then handle the error... Thanks for you insight... One more question if you dont mind... What is the rule about placing TRY/CATCH blocks in the application_error event? Thanks again for all you input... Brandon

          M 1 Reply Last reply
          0
          • B braber

            Right, I have been doing the research... It seems that all ASP.NET requests are handled through IIS which get directed to the aspnet_isapi.dll which then handle the error... Thanks for you insight... One more question if you dont mind... What is the rule about placing TRY/CATCH blocks in the application_error event? Thanks again for all you input... Brandon

            M Offline
            M Offline
            Mike Ellison
            wrote on last edited by
            #5

            Hi Brandon. I'm not sure there is a rule about placing try/catch blocks in the application_error event. I think it works just like it would for any other procedure - if an exception occurs and it isn't handled in a try/catch block, it is thrown to the caller (and I think in the case of Application_Error, an exception there is just bubbled up as an unhandled exception).

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups