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. global.asax Type 'EventArgs' not defined

global.asax Type 'EventArgs' not defined

Scheduled Pinned Locked Moved ASP.NET
collaborationhelpquestion
9 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.
  • B Offline
    B Offline
    bubberz
    wrote on last edited by
    #1

    I just tried to add a global.asax file (right click, and "Add New Item" to my application, and get: Type 'EventArgs' is not defined ...in the parameters section for the routines inside the global.asax page. I want to have the page errors / exceptions notices sent to the development team, but I can't get past this 'Event Args' error. I'm trying the following in the global.asax and the build liked it: Imports System.EventArgs ...subroutine now looks like: Sub Application_Error(ByVal sender As Object, ByVal e As System.EventArgs) ..instead of previous: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) Any suggestions are welcome! Is this allowed??????? Thanks!

    I 1 Reply Last reply
    0
    • B bubberz

      I just tried to add a global.asax file (right click, and "Add New Item" to my application, and get: Type 'EventArgs' is not defined ...in the parameters section for the routines inside the global.asax page. I want to have the page errors / exceptions notices sent to the development team, but I can't get past this 'Event Args' error. I'm trying the following in the global.asax and the build liked it: Imports System.EventArgs ...subroutine now looks like: Sub Application_Error(ByVal sender As Object, ByVal e As System.EventArgs) ..instead of previous: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) Any suggestions are welcome! Is this allowed??????? Thanks!

      I Offline
      I Offline
      Ista
      wrote on last edited by
      #2

      First you can only import namespaces. EventArgs is a class Both of your subr are exactly the same. Since the top of your file has Imports System; then every class is reachable inside the "System" namespace. try making the method protected. I don't do VB anymore so Its hard to read 1 line of code equals many bugs. So don't write any!!

      B 1 Reply Last reply
      0
      • I Ista

        First you can only import namespaces. EventArgs is a class Both of your subr are exactly the same. Since the top of your file has Imports System; then every class is reachable inside the "System" namespace. try making the method protected. I don't do VB anymore so Its hard to read 1 line of code equals many bugs. So don't write any!!

        B Offline
        B Offline
        bubberz
        wrote on last edited by
        #3

        Ista, I just put the following at the top of the global.asax page, and that looked like it fixed the issue: Imports System Basically, "Imports System" was never there in the first place till I just added it. Shouldn't this be okay now? The blue "squiggly" is gone, so it looks like the code is correct and a build succeeded. Thanks!

        I 1 Reply Last reply
        0
        • B bubberz

          Ista, I just put the following at the top of the global.asax page, and that looked like it fixed the issue: Imports System Basically, "Imports System" was never there in the first place till I just added it. Shouldn't this be okay now? The blue "squiggly" is gone, so it looks like the code is correct and a build succeeded. Thanks!

          I Offline
          I Offline
          Ista
          wrote on last edited by
          #4

          in your page put this code throw new NotSupportedException(); This will throw an exception and you'll see if your idea worked or not 1 line of code equals many bugs. So don't write any!!

          B 1 Reply Last reply
          0
          • I Ista

            in your page put this code throw new NotSupportedException(); This will throw an exception and you'll see if your idea worked or not 1 line of code equals many bugs. So don't write any!!

            B Offline
            B Offline
            bubberz
            wrote on last edited by
            #5

            Ista, I did the following in the global.asax file: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) Throw New NotSupportedException ...ran the app and no errors on build or running the application. Thanks!

            I 1 Reply Last reply
            0
            • B bubberz

              Ista, I did the following in the global.asax file: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) Throw New NotSupportedException ...ran the app and no errors on build or running the application. Thanks!

              I Offline
              I Offline
              Ista
              wrote on last edited by
              #6

              check this link http://support.microsoft.com/default.aspx?scid=kb;en-us;306355[^] 1 line of code equals many bugs. So don't write any!!

              B 1 Reply Last reply
              0
              • I Ista

                check this link http://support.microsoft.com/default.aspx?scid=kb;en-us;306355[^] 1 line of code equals many bugs. So don't write any!!

                B Offline
                B Offline
                bubberz
                wrote on last edited by
                #7

                Thanks Ista! That's exactly what I was doing...except in VB: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Fires when an error occurs Dim ex As System.Exception = Server.GetLastError() If Not ex.GetType.FullName = "System.Web.HttpException" Then Dim message As MailMessage = New MailMessage message.From = "help@help.com" message.To = "help@help.com" message.Subject = "Problem: " & ex.Message message.Body = "InnerException: " & ex.InnerException.Message & _ "StackTrace: " & ex.StackTrace & System.Environment.NewLine & _ "DateTime: " & Now.ToString & System.Environment.NewLine & _ "Source: " & Context.Current.Request.Url.ToString() SmtpMail.Send(message) End If End Sub

                I 1 Reply Last reply
                0
                • B bubberz

                  Thanks Ista! That's exactly what I was doing...except in VB: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Fires when an error occurs Dim ex As System.Exception = Server.GetLastError() If Not ex.GetType.FullName = "System.Web.HttpException" Then Dim message As MailMessage = New MailMessage message.From = "help@help.com" message.To = "help@help.com" message.Subject = "Problem: " & ex.Message message.Body = "InnerException: " & ex.InnerException.Message & _ "StackTrace: " & ex.StackTrace & System.Environment.NewLine & _ "DateTime: " & Now.ToString & System.Environment.NewLine & _ "Source: " & Context.Current.Request.Url.ToString() SmtpMail.Send(message) End If End Sub

                  I Offline
                  I Offline
                  Ista
                  wrote on last edited by
                  #8

                  so did you get an email? I see you have set to only an HttpException. What if the code violates a file permission? Why not catch all the errors into a log and write a small app that can filter them. Nick 1 line of code equals many bugs. So don't write any!!

                  B 1 Reply Last reply
                  0
                  • I Ista

                    so did you get an email? I see you have set to only an HttpException. What if the code violates a file permission? Why not catch all the errors into a log and write a small app that can filter them. Nick 1 line of code equals many bugs. So don't write any!!

                    B Offline
                    B Offline
                    bubberz
                    wrote on last edited by
                    #9

                    Nick, Thanks for staying on top of this. This is a new area for me. I thought I would get everything except HttpExceptions with: If Not ex.GetType.FullName = "System.Web.HttpException" Then

                    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