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