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. How to get error number in global.asax

How to get error number in global.asax

Scheduled Pinned Locked Moved ASP.NET
helptutorial
5 Posts 2 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.
  • S Offline
    S Offline
    Software_Guy_123
    wrote on last edited by
    #1

    Hello All, We have error handling code in global.asax. If any error occurs, it will send email to admin. We want to capture error number and depending on error numbers we would like to send email or no. We will put some error numbers in web.config and check if error number is presents in web.config then don't send email. How can we get error number in Global.asax. Any sample code or URL, it will be great.

    Thanks & Regards, Kumar

    H 1 Reply Last reply
    0
    • S Software_Guy_123

      Hello All, We have error handling code in global.asax. If any error occurs, it will send email to admin. We want to capture error number and depending on error numbers we would like to send email or no. We will put some error numbers in web.config and check if error number is presents in web.config then don't send email. How can we get error number in Global.asax. Any sample code or URL, it will be great.

      Thanks & Regards, Kumar

      H Offline
      H Offline
      hammdo
      wrote on last edited by
      #2

      Kumar: I've used this technique from MS and it has worked very well: [^] Looks for the 'global.asax' example (its in VB.NET but can be easily converted to C#) -Don

      S 1 Reply Last reply
      0
      • H hammdo

        Kumar: I've used this technique from MS and it has worked very well: [^] Looks for the 'global.asax' example (its in VB.NET but can be easily converted to C#) -Don

        S Offline
        S Offline
        Software_Guy_123
        wrote on last edited by
        #3

        Thanks. We have code as in KB example, its working but we want to know error number.

        Thanks & Regards, Kumar

        H 1 Reply Last reply
        0
        • S Software_Guy_123

          Thanks. We have code as in KB example, its working but we want to know error number.

          Thanks & Regards, Kumar

          H Offline
          H Offline
          hammdo
          wrote on last edited by
          #4

          The Exception Class has a protected member for HRESULT . If you derive a class from System.Exception, you can get access to that value. That should contain any 'number' associated to the error (if one was generated). HRESULT has 3 parts to it: a severity code, a facility code, and an error code. There is more detail here: http://msdn2.microsoft.com/en-us/library/system.exception.hresult(VS.71).aspx Example is there. Hope that helps... -Don

          S 1 Reply Last reply
          0
          • H hammdo

            The Exception Class has a protected member for HRESULT . If you derive a class from System.Exception, you can get access to that value. That should contain any 'number' associated to the error (if one was generated). HRESULT has 3 parts to it: a severity code, a facility code, and an error code. There is more detail here: http://msdn2.microsoft.com/en-us/library/system.exception.hresult(VS.71).aspx Example is there. Hope that helps... -Don

            S Offline
            S Offline
            Software_Guy_123
            wrote on last edited by
            #5

            Hello Don, Thank you for reply, I will check this.

            Thanks & Regards, Kumar

            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