473,396 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Global.asax not firing

This is a strange problem. I have a project where the contents of
global.asax application_error are not firing. It is an asp.net 2.0
application using web application projects. I have another app using
web application projects and it's firing fine but it was upgraded from
the 1.1 framework.

Why doesn't my global.asax application_error routine fire?

Jun 20 '06 #1
19 10138
can you produce some code to clearly demonstrate the problem? you can post
here with the code once you have got it ready

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
<fu*********@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
This is a strange problem. I have a project where the contents of
global.asax application_error are not firing. It is an asp.net 2.0
application using web application projects. I have another app using
web application projects and it's firing fine but it was upgraded from
the 1.1 framework.

Why doesn't my global.asax application_error routine fire?

Jun 21 '06 #2
Sure. This is the global.asax file:

Imports System.Web.SessionState
Imports cti.common
Public Class Global_asax
Inherits System.Web.HttpApplication

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)
' Fires at the beginning of each request
End Sub

Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
As EventArgs)
' Fires upon attempting to authenticate the use
End Sub

Public Sub Application_Error(ByVal sender As Object, ByVal e As
EventArgs)
' Fires when an error occurs

Dim strDeveloperEmail As String

Response.Redirect("/feedback.aspx")
'asldkfj

'If user is a developer, do Nothing, don't send e-mail, but
show error message.
If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")
CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress "), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _

ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))

Response.Redirect("/error.aspx")
End If
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub

Function BuildMessage() As String

Dim strMessage As New StringBuilder

strMessage.Append("Username: " &
Request.ServerVariables("LOGON_USER"))
strMessage.Append("<br>")
strMessage.Append("IP Address: " &
Request.ServerVariables("REMOTE_ADDR"))
strMessage.Append("<br>")
strMessage.Append("User Agent: " &
Request.ServerVariables("HTTP_USER_AGENT"))
strMessage.Append("<br>")
strMessage.Append("Page: " & Request.Url.AbsoluteUri)
strMessage.Append("<br>")
strMessage.Append("Time: " & System.DateTime.Now)
strMessage.Append("<br>")
strMessage.Append("Details: " &
Server.GetLastError().InnerException.ToString())
Return strMessage.ToString

End Function

End Class

as you can see, I have it redirect to /feedback.aspx just for testing
to see if it's even running and it's not. Here's the code to create an
unhandled exception:

Dim dblTest As Double

dblTest = ""

Thanks in advance.

Alvin Bruney [MVP] wrote:
can you produce some code to clearly demonstrate the problem? you can post
here with the code once you have got it ready

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
<fu*********@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
This is a strange problem. I have a project where the contents of
global.asax application_error are not firing. It is an asp.net 2.0
application using web application projects. I have another app using
web application projects and it's firing fine but it was upgraded from
the 1.1 framework.

Why doesn't my global.asax application_error routine fire?


Jun 21 '06 #3
re:
as you can see, I have it redirect to /feedback.aspx just for testing to see if
it's even running and it's not. Here's the code to create an unhandled exception:
Dim dblTest As Double
dblTest = ""
It seems that you're not catching the right type of exception.

Please review :

http://msdn2.microsoft.com/en-us/sys...n_members.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com... Sure. This is the global.asax file:

Imports System.Web.SessionState
Imports cti.common
Public Class Global_asax
Inherits System.Web.HttpApplication

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)
' Fires at the beginning of each request
End Sub

Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
As EventArgs)
' Fires upon attempting to authenticate the use
End Sub

Public Sub Application_Error(ByVal sender As Object, ByVal e As
EventArgs)
' Fires when an error occurs

Dim strDeveloperEmail As String

Response.Redirect("/feedback.aspx")
'asldkfj

'If user is a developer, do Nothing, don't send e-mail, but
show error message.
If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")
CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress "), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _

ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))

Response.Redirect("/error.aspx")
End If
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub

Function BuildMessage() As String

Dim strMessage As New StringBuilder

strMessage.Append("Username: " &
Request.ServerVariables("LOGON_USER"))
strMessage.Append("<br>")
strMessage.Append("IP Address: " &
Request.ServerVariables("REMOTE_ADDR"))
strMessage.Append("<br>")
strMessage.Append("User Agent: " &
Request.ServerVariables("HTTP_USER_AGENT"))
strMessage.Append("<br>")
strMessage.Append("Page: " & Request.Url.AbsoluteUri)
strMessage.Append("<br>")
strMessage.Append("Time: " & System.DateTime.Now)
strMessage.Append("<br>")
strMessage.Append("Details: " &
Server.GetLastError().InnerException.ToString())
Return strMessage.ToString

End Function

End Class

as you can see, I have it redirect to /feedback.aspx just for testing
to see if it's even running and it's not. Here's the code to create an
unhandled exception:

Dim dblTest As Double

dblTest = ""

Thanks in advance.

Alvin Bruney [MVP] wrote:
can you produce some code to clearly demonstrate the problem? you can post
here with the code once you have got it ready

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
<fu*********@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
> This is a strange problem. I have a project where the contents of
> global.asax application_error are not firing. It is an asp.net 2.0
> application using web application projects. I have another app using
> web application projects and it's firing fine but it was upgraded from
> the 1.1 framework.
>
> Why doesn't my global.asax application_error routine fire?
>

Jun 21 '06 #4
I don't think that's it. I have another 2.0 application with the exact
same code and the global.asax file catches it and takes appropriate
action. Maybe I just need to recreate the project?

Juan T. Llibre wrote:
re:
as you can see, I have it redirect to /feedback.aspx just for testing to see if
it's even running and it's not. Here's the code to create an unhandledexception:
Dim dblTest As Double
dblTest = ""


It seems that you're not catching the right type of exception.

Please review :

http://msdn2.microsoft.com/en-us/sys...n_members.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Sure. This is the global.asax file:

Imports System.Web.SessionState
Imports cti.common
Public Class Global_asax
Inherits System.Web.HttpApplication

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)
' Fires at the beginning of each request
End Sub

Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
As EventArgs)
' Fires upon attempting to authenticate the use
End Sub

Public Sub Application_Error(ByVal sender As Object, ByVal e As
EventArgs)
' Fires when an error occurs

Dim strDeveloperEmail As String

Response.Redirect("/feedback.aspx")
'asldkfj

'If user is a developer, do Nothing, don't send e-mail, but
show error message.
If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")
CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress "), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _

ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))

Response.Redirect("/error.aspx")
End If
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub

Function BuildMessage() As String

Dim strMessage As New StringBuilder

strMessage.Append("Username: " &
Request.ServerVariables("LOGON_USER"))
strMessage.Append("<br>")
strMessage.Append("IP Address: " &
Request.ServerVariables("REMOTE_ADDR"))
strMessage.Append("<br>")
strMessage.Append("User Agent: " &
Request.ServerVariables("HTTP_USER_AGENT"))
strMessage.Append("<br>")
strMessage.Append("Page: " & Request.Url.AbsoluteUri)
strMessage.Append("<br>")
strMessage.Append("Time: " & System.DateTime.Now)
strMessage.Append("<br>")
strMessage.Append("Details: " &
Server.GetLastError().InnerException.ToString())
Return strMessage.ToString

End Function

End Class

as you can see, I have it redirect to /feedback.aspx just for testing
to see if it's even running and it's not. Here's the code to create an
unhandled exception:

Dim dblTest As Double

dblTest = ""

Thanks in advance.

Alvin Bruney [MVP] wrote:
can you produce some code to clearly demonstrate the problem? you can post
here with the code once you have got it ready

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
<fu*********@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
> This is a strange problem. I have a project where the contents of
> global.asax application_error are not firing. It is an asp.net 2.0
> application using web application projects. I have another app using
> web application projects and it's firing fine but it was upgraded from
> the 1.1 framework.
>
> Why doesn't my global.asax application_error routine fire?
>


Jun 22 '06 #5
Did you get a resolution to this problem?
I have the same problem too. All working fine on development machine, but
Application_Error event doesn't fire on production machine. Other events are
firing okay on production machine e.g. Session_Start.

--
Mark
"fu*********@gmail.com" wrote:
I don't think that's it. I have another 2.0 application with the exact
same code and the global.asax file catches it and takes appropriate
action. Maybe I just need to recreate the project?

Juan T. Llibre wrote:
re:
as you can see, I have it redirect to /feedback.aspx just for testing to see if
it's even running and it's not. Here's the code to create an unhandled exception:
Dim dblTest As Double
dblTest = ""


It seems that you're not catching the right type of exception.

Please review :

http://msdn2.microsoft.com/en-us/sys...n_members.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Sure. This is the global.asax file:

Imports System.Web.SessionState
Imports cti.common
Public Class Global_asax
Inherits System.Web.HttpApplication

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)
' Fires at the beginning of each request
End Sub

Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
As EventArgs)
' Fires upon attempting to authenticate the use
End Sub

Public Sub Application_Error(ByVal sender As Object, ByVal e As
EventArgs)
' Fires when an error occurs

Dim strDeveloperEmail As String

Response.Redirect("/feedback.aspx")
'asldkfj

'If user is a developer, do Nothing, don't send e-mail, but
show error message.
If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")
CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress "), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _

ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))

Response.Redirect("/error.aspx")
End If
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub

Function BuildMessage() As String

Dim strMessage As New StringBuilder

strMessage.Append("Username: " &
Request.ServerVariables("LOGON_USER"))
strMessage.Append("<br>")
strMessage.Append("IP Address: " &
Request.ServerVariables("REMOTE_ADDR"))
strMessage.Append("<br>")
strMessage.Append("User Agent: " &
Request.ServerVariables("HTTP_USER_AGENT"))
strMessage.Append("<br>")
strMessage.Append("Page: " & Request.Url.AbsoluteUri)
strMessage.Append("<br>")
strMessage.Append("Time: " & System.DateTime.Now)
strMessage.Append("<br>")
strMessage.Append("Details: " &
Server.GetLastError().InnerException.ToString())
Return strMessage.ToString

End Function

End Class

as you can see, I have it redirect to /feedback.aspx just for testing
to see if it's even running and it's not. Here's the code to create an
unhandled exception:

Dim dblTest As Double

dblTest = ""

Thanks in advance.

Alvin Bruney [MVP] wrote:
> can you produce some code to clearly demonstrate the problem? you can post
> here with the code once you have got it ready
>
> --
> ________________________
> Warm regards,
> Alvin Bruney [MVP ASP.NET]
>
> [Shameless Author plug]
> Professional VSTO.NET - Wrox/Wiley
> The O.W.C. Black Book with .NET
> www.lulu.com/owc, Amazon
> Blog: http://www.msmvps.com/blogs/alvin
> -------------------------------------------------------
>
>
> <fu*********@gmail.com> wrote in message
> news:11**********************@g10g2000cwb.googlegr oups.com...
> > This is a strange problem. I have a project where the contents of
> > global.asax application_error are not firing. It is an asp.net 2.0
> > application using web application projects. I have another app using
> > web application projects and it's firing fine but it was upgraded from
> > the 1.1 framework.
> >
> > Why doesn't my global.asax application_error routine fire?
> >


Jun 30 '06 #6
No I haven't. I haven't gotten around to try to recreate the project
yet. That is my next step.
Mark Lewis wrote:
Did you get a resolution to this problem?
I have the same problem too. All working fine on development machine, but
Application_Error event doesn't fire on production machine. Other events are
firing okay on production machine e.g. Session_Start.

--
Mark
"fu*********@gmail.com" wrote:
I don't think that's it. I have another 2.0 application with the exact
same code and the global.asax file catches it and takes appropriate
action. Maybe I just need to recreate the project?

Juan T. Llibre wrote:
re:
> as you can see, I have it redirect to /feedback.aspx just for testing to see if
> it's even running and it's not. Here's the code to create an unhandled exception:
> Dim dblTest As Double
> dblTest = ""

It seems that you're not catching the right type of exception.

Please review :

http://msdn2.microsoft.com/en-us/sys...n_members.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
> Sure. This is the global.asax file:
>
> Imports System.Web.SessionState
> Imports cti.common
> Public Class Global_asax
> Inherits System.Web.HttpApplication
>
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
> ' Fires when the application is started
> End Sub
>
> Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
> ' Fires when the session is started
> End Sub
>
> Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
> EventArgs)
> ' Fires at the beginning of each request
> End Sub
>
> Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
> As EventArgs)
> ' Fires upon attempting to authenticate the use
> End Sub
>
> Public Sub Application_Error(ByVal sender As Object, ByVal e As
> EventArgs)
> ' Fires when an error occurs
>
> Dim strDeveloperEmail As String
>
> Response.Redirect("/feedback.aspx")
> 'asldkfj
>
> 'If user is a developer, do Nothing, don't send e-mail, but
> show error message.
> If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
> & "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
> Then
> 'Otherwise just send e-mail and redirect to a friendly
> page.
> Else
> strDeveloperEmail =
> GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
> ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")
>
>
> CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
> ConfigurationManager.AppSettings("EmailFromAddress "), _
> strDeveloperEmail, _
> "", _
> "Portal Application Error", _
> BuildMessage(), _
> "Normal", _
>
> ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))
>
> Response.Redirect("/error.aspx")
> End If
> End Sub
>
> Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
> ' Fires when the session ends
> End Sub
>
> Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
> ' Fires when the application ends
> End Sub
>
> Function BuildMessage() As String
>
> Dim strMessage As New StringBuilder
>
> strMessage.Append("Username: " &
> Request.ServerVariables("LOGON_USER"))
> strMessage.Append("<br>")
> strMessage.Append("IP Address: " &
> Request.ServerVariables("REMOTE_ADDR"))
> strMessage.Append("<br>")
> strMessage.Append("User Agent: " &
> Request.ServerVariables("HTTP_USER_AGENT"))
> strMessage.Append("<br>")
> strMessage.Append("Page: " & Request.Url.AbsoluteUri)
> strMessage.Append("<br>")
> strMessage.Append("Time: " & System.DateTime.Now)
> strMessage.Append("<br>")
> strMessage.Append("Details: " &
> Server.GetLastError().InnerException.ToString())
> Return strMessage.ToString
>
> End Function
>
> End Class
>
> as you can see, I have it redirect to /feedback.aspx just for testing
> to see if it's even running and it's not. Here's the code to create an
> unhandled exception:
>
> Dim dblTest As Double
>
> dblTest = ""
>
> Thanks in advance.
>
> Alvin Bruney [MVP] wrote:
>> can you produce some code to clearly demonstrate the problem? you can post
>> here with the code once you have got it ready
>>
>> --
>> ________________________
>> Warm regards,
>> Alvin Bruney [MVP ASP.NET]
>>
>> [Shameless Author plug]
>> Professional VSTO.NET - Wrox/Wiley
>> The O.W.C. Black Book with .NET
>> www.lulu.com/owc, Amazon
>> Blog: http://www.msmvps.com/blogs/alvin
>> -------------------------------------------------------
>>
>>
>> <fu*********@gmail.com> wrote in message
>> news:11**********************@g10g2000cwb.googlegr oups.com...
>> > This is a strange problem. I have a project where the contents of
>> > global.asax application_error are not firing. It is an asp.net 2.0
>> > application using web application projects. I have another app using
>> > web application projects and it's firing fine but it was upgraded from
>> > the 1.1 framework.
>> >
>> > Why doesn't my global.asax application_error routine fire?
>> >
>



Jun 30 '06 #7
Recreating the project did not work. There's something to set on the
production machine, but I can't find it. I've compared settings for
IIS, web.config, between my working development and production machines
to the new production machine and they're all the same. I've
reinstalled asp.net 2.0, I've completed all critical updates. What
else is there to try?

Anyone have any ideas? Ugh.

fu*********@gmail.com wrote:
No I haven't. I haven't gotten around to try to recreate the project
yet. That is my next step.
Mark Lewis wrote:
Did you get a resolution to this problem?
I have the same problem too. All working fine on development machine, but
Application_Error event doesn't fire on production machine. Other events are
firing okay on production machine e.g. Session_Start.

--
Mark
"fu*********@gmail.com" wrote:
I don't think that's it. I have another 2.0 application with the exact
same code and the global.asax file catches it and takes appropriate
action. Maybe I just need to recreate the project?
>
Juan T. Llibre wrote:
re:
as you can see, I have it redirect to /feedback.aspx just for testing to see if
it's even running and it's not. Here's the code to create an unhandled exception:
Dim dblTest As Double
dblTest = ""

It seems that you're not catching the right type of exception.

Please review :

http://msdn2.microsoft.com/en-us/sys...n_members.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx




Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Sure. This is the global.asax file:
>
Imports System.Web.SessionState
Imports cti.common
Public Class Global_asax
Inherits System.Web.HttpApplication
>
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub
>
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub
>
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)
' Fires at the beginning of each request
End Sub
>
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
As EventArgs)
' Fires upon attempting to authenticate the use
End Sub
>
Public Sub Application_Error(ByVal sender As Object, ByVal e As
EventArgs)
' Fires when an error occurs
>
Dim strDeveloperEmail As String
>
Response.Redirect("/feedback.aspx")
'asldkfj
>
'If user is a developer, do Nothing, don't send e-mail, but
show error message.
If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")
>
>
CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress "), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _
>
ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))
>
Response.Redirect("/error.aspx")
End If
End Sub
>
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub
>
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub
>
Function BuildMessage() As String
>
Dim strMessage As New StringBuilder
>
strMessage.Append("Username: " &
Request.ServerVariables("LOGON_USER"))
strMessage.Append("<br>")
strMessage.Append("IP Address: " &
Request.ServerVariables("REMOTE_ADDR"))
strMessage.Append("<br>")
strMessage.Append("User Agent: " &
Request.ServerVariables("HTTP_USER_AGENT"))
strMessage.Append("<br>")
strMessage.Append("Page: " & Request.Url.AbsoluteUri)
strMessage.Append("<br>")
strMessage.Append("Time: " & System.DateTime.Now)
strMessage.Append("<br>")
strMessage.Append("Details: " &
Server.GetLastError().InnerException.ToString())
Return strMessage.ToString
>
End Function
>
End Class
>
as you can see, I have it redirect to /feedback.aspx just for testing
to see if it's even running and it's not. Here's the code to create an
unhandled exception:
>
Dim dblTest As Double
>
dblTest = ""
>
Thanks in advance.
>
Alvin Bruney [MVP] wrote:
>can you produce some code to clearly demonstrate the problem? you can post
>here with the code once you have got it ready
>>
>--
>________________________
>Warm regards,
>Alvin Bruney [MVP ASP.NET]
>>
>[Shameless Author plug]
>Professional VSTO.NET - Wrox/Wiley
>The O.W.C. Black Book with .NET
>www.lulu.com/owc, Amazon
>Blog: http://www.msmvps.com/blogs/alvin
>-------------------------------------------------------
>>
>>
><fu*********@gmail.comwrote in message
>news:11**********************@g10g2000cwb.googleg roups.com...
This is a strange problem. I have a project where the contents of
global.asax application_error are not firing. It is an asp.net 2.0
application using web application projects. I have another app using
web application projects and it's firing fine but it was upgraded from
the 1.1 framework.
>
Why doesn't my global.asax application_error routine fire?
>
>

>
Jul 12 '06 #8
Please verify that your code conforms to accepted practices
for capturing Application Error events per these articles :

http://www.quepublishing.com/article...p?p=25171&rl=1
(includes sample code)

http://www.angrycoder.com/article.as...=2001&m=4&d=18
(includes sample code)

http://www.dotnetjohn.com/articles.aspx?articleid=42
(includes sample code)


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
Recreating the project did not work. There's something to set on the
production machine, but I can't find it. I've compared settings for
IIS, web.config, between my working development and production machines
to the new production machine and they're all the same. I've
reinstalled asp.net 2.0, I've completed all critical updates. What
else is there to try?

Anyone have any ideas? Ugh.

fu*********@gmail.com wrote:
No I haven't. I haven't gotten around to try to recreate the project
yet. That is my next step.
Mark Lewis wrote:
Did you get a resolution to this problem?
I have the same problem too. All working fine on development machine, but
Application_Error event doesn't fire on production machine. Other events are
firing okay on production machine e.g. Session_Start.

--
Mark
"fu*********@gmail.com" wrote:
I don't think that's it. I have another 2.0 application with the exact
same code and the global.asax file catches it and takes appropriate
action. Maybe I just need to recreate the project?
>
Juan T. Llibre wrote:
re:
as you can see, I have it redirect to /feedback.aspx just for testing to see if
it's even running and it's not. Here's the code to create an unhandled exception:
Dim dblTest As Double
dblTest = ""

It seems that you're not catching the right type of exception.

Please review :

http://msdn2.microsoft.com/en-us/sys...n_members.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx




Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Sure. This is the global.asax file:
>
Imports System.Web.SessionState
Imports cti.common
Public Class Global_asax
Inherits System.Web.HttpApplication
>
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub
>
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub
>
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)
' Fires at the beginning of each request
End Sub
>
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
As EventArgs)
' Fires upon attempting to authenticate the use
End Sub
>
Public Sub Application_Error(ByVal sender As Object, ByVal e As
EventArgs)
' Fires when an error occurs
>
Dim strDeveloperEmail As String
>
Response.Redirect("/feedback.aspx")
'asldkfj
>
'If user is a developer, do Nothing, don't send e-mail, but
show error message.
If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")
>
>
CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress "), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _
>
ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))
>
Response.Redirect("/error.aspx")
End If
End Sub
>
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub
>
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub
>
Function BuildMessage() As String
>
Dim strMessage As New StringBuilder
>
strMessage.Append("Username: " &
Request.ServerVariables("LOGON_USER"))
strMessage.Append("<br>")
strMessage.Append("IP Address: " &
Request.ServerVariables("REMOTE_ADDR"))
strMessage.Append("<br>")
strMessage.Append("User Agent: " &
Request.ServerVariables("HTTP_USER_AGENT"))
strMessage.Append("<br>")
strMessage.Append("Page: " & Request.Url.AbsoluteUri)
strMessage.Append("<br>")
strMessage.Append("Time: " & System.DateTime.Now)
strMessage.Append("<br>")
strMessage.Append("Details: " &
Server.GetLastError().InnerException.ToString())
Return strMessage.ToString
>
End Function
>
End Class
>
as you can see, I have it redirect to /feedback.aspx just for testing
to see if it's even running and it's not. Here's the code to create an
unhandled exception:
>
Dim dblTest As Double
>
dblTest = ""
>
Thanks in advance.
>
Alvin Bruney [MVP] wrote:
>can you produce some code to clearly demonstrate the problem? you can post
>here with the code once you have got it ready
>>
>--
>________________________
>Warm regards,
>Alvin Bruney [MVP ASP.NET]
>>
>[Shameless Author plug]
>Professional VSTO.NET - Wrox/Wiley
>The O.W.C. Black Book with .NET
>www.lulu.com/owc, Amazon
>Blog: http://www.msmvps.com/blogs/alvin
>-------------------------------------------------------
>>
>>
><fu*********@gmail.comwrote in message
>news:11**********************@g10g2000cwb.googleg roups.com...
This is a strange problem. I have a project where the contents of
global.asax application_error are not firing. It is an asp.net 2.0
application using web application projects. I have another app using
web application projects and it's firing fine but it was upgraded from
the 1.1 framework.
>
Why doesn't my global.asax application_error routine fire?
>
>
>
>

Jul 12 '06 #9
I appreciate your help Juan. But again, the global.asax file fires
just fine on my development machine and on another production machine.
The code should be fine. Wouldn't you agree?

There is something that is preventing it from firing on this particular
production machine.

Juan T. Llibre wrote:
Please verify that your code conforms to accepted practices
for capturing Application Error events per these articles :

http://www.quepublishing.com/article...p?p=25171&rl=1
(includes sample code)

http://www.angrycoder.com/article.as...=2001&m=4&d=18
(includes sample code)

http://www.dotnetjohn.com/articles.aspx?articleid=42
(includes sample code)


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
Recreating the project did not work. There's something to set on the
production machine, but I can't find it. I've compared settings for
IIS, web.config, between my working development and production machines
to the new production machine and they're all the same. I've
reinstalled asp.net 2.0, I've completed all critical updates. What
else is there to try?

Anyone have any ideas? Ugh.

fu*********@gmail.com wrote:
No I haven't. I haven't gotten around to try to recreate the project
yet. That is my next step.
Mark Lewis wrote:
Did you get a resolution to this problem?
I have the same problem too. All working fine on development machine,but
Application_Error event doesn't fire on production machine. Other events are
firing okay on production machine e.g. Session_Start.
>
--
Mark
>
>
"fu*********@gmail.com" wrote:
>
I don't think that's it. I have another 2.0 application with the exact
same code and the global.asax file catches it and takes appropriate
action. Maybe I just need to recreate the project?

Juan T. Llibre wrote:
re:
as you can see, I have it redirect to /feedback.aspx just for testing to see if
it's even running and it's not. Here's the code to create an unhandled exception:
Dim dblTest As Double
dblTest = ""
>
It seems that you're not catching the right type of exception.
>
Please review :
>
http://msdn2.microsoft.com/en-us/sys...n_members.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
>
>
>
>
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Sure. This is the global.asax file:

Imports System.Web.SessionState
Imports cti.common
Public Class Global_asax
Inherits System.Web.HttpApplication

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub

Sub Application_BeginRequest(ByVal sender As Object, ByVal eAs
EventArgs)
' Fires at the beginning of each request
End Sub

Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
As EventArgs)
' Fires upon attempting to authenticate the use
End Sub

Public Sub Application_Error(ByVal sender As Object, ByVal eAs
EventArgs)
' Fires when an error occurs

Dim strDeveloperEmail As String

Response.Redirect("/feedback.aspx")
'asldkfj

'If user is a developer, do Nothing, don't send e-mail, but
show error message.
If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")


CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress "), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _

ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))

Response.Redirect("/error.aspx")
End If
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub

Function BuildMessage() As String

Dim strMessage As New StringBuilder

strMessage.Append("Username: " &
Request.ServerVariables("LOGON_USER"))
strMessage.Append("<br>")
strMessage.Append("IP Address: " &
Request.ServerVariables("REMOTE_ADDR"))
strMessage.Append("<br>")
strMessage.Append("User Agent: " &
Request.ServerVariables("HTTP_USER_AGENT"))
strMessage.Append("<br>")
strMessage.Append("Page: " & Request.Url.AbsoluteUri)
strMessage.Append("<br>")
strMessage.Append("Time: " & System.DateTime.Now)
strMessage.Append("<br>")
strMessage.Append("Details: " &
Server.GetLastError().InnerException.ToString())
Return strMessage.ToString

End Function

End Class

as you can see, I have it redirect to /feedback.aspx just for testing
to see if it's even running and it's not. Here's the code to create an
unhandled exception:

Dim dblTest As Double

dblTest = ""

Thanks in advance.

Alvin Bruney [MVP] wrote:
can you produce some code to clearly demonstrate the problem? you can post
here with the code once you have got it ready
>
--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
>
[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
>
>
<fu*********@gmail.comwrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
This is a strange problem. I have a project where the contents of
global.asax application_error are not firing. It is an asp.net 2.0
application using web application projects. I have another app using
web application projects and it's firing fine but it was upgraded from
the 1.1 framework.

Why doesn't my global.asax application_error routine fire?


Jul 12 '06 #10
re:
There is something that is preventing it from firing on this particular production machine.
Look for permissions issues.

Make sure all the directories for the production machine have the
proper permissions for the account which ASP.NET is running as, per :

http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx

Make sure you know the correct account which
ASP.NET is running as on that machine.

If you have doubts as to which account that is, run this file :

identity.aspx:
-------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
--------

Give the permissions outlined at:
http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx
to whichever account is reported as the ASP.NEt account by "identity.aspx".

Let us know what happens...


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
I appreciate your help Juan. But again, the global.asax file fires
just fine on my development machine and on another production machine.
The code should be fine. Wouldn't you agree?

There is something that is preventing it from firing on this particular
production machine.

Juan T. Llibre wrote:
Please verify that your code conforms to accepted practices
for capturing Application Error events per these articles :

http://www.quepublishing.com/article...p?p=25171&rl=1
(includes sample code)

http://www.angrycoder.com/article.as...=2001&m=4&d=18
(includes sample code)

http://www.dotnetjohn.com/articles.aspx?articleid=42
(includes sample code)


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
Recreating the project did not work. There's something to set on the
production machine, but I can't find it. I've compared settings for
IIS, web.config, between my working development and production machines
to the new production machine and they're all the same. I've
reinstalled asp.net 2.0, I've completed all critical updates. What
else is there to try?

Anyone have any ideas? Ugh.

fu*********@gmail.com wrote:
No I haven't. I haven't gotten around to try to recreate the project
yet. That is my next step.
Mark Lewis wrote:
Did you get a resolution to this problem?
I have the same problem too. All working fine on development machine, but
Application_Error event doesn't fire on production machine. Other events are
firing okay on production machine e.g. Session_Start.
>
--
Mark
>
>
"fu*********@gmail.com" wrote:
>
I don't think that's it. I have another 2.0 application with the exact
same code and the global.asax file catches it and takes appropriate
action. Maybe I just need to recreate the project?

Juan T. Llibre wrote:
re:
as you can see, I have it redirect to /feedback.aspx just for testing to see if
it's even running and it's not. Here's the code to create an unhandled exception:
Dim dblTest As Double
dblTest = ""
>
It seems that you're not catching the right type of exception.
>
Please review :
>
http://msdn2.microsoft.com/en-us/sys...n_members.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
>
>
>
>
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Sure. This is the global.asax file:

Imports System.Web.SessionState
Imports cti.common
Public Class Global_asax
Inherits System.Web.HttpApplication

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)
' Fires at the beginning of each request
End Sub

Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
As EventArgs)
' Fires upon attempting to authenticate the use
End Sub

Public Sub Application_Error(ByVal sender As Object, ByVal e As
EventArgs)
' Fires when an error occurs

Dim strDeveloperEmail As String

Response.Redirect("/feedback.aspx")
'asldkfj

'If user is a developer, do Nothing, don't send e-mail, but
show error message.
If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")


CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress "), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _

ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))

Response.Redirect("/error.aspx")
End If
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub

Function BuildMessage() As String

Dim strMessage As New StringBuilder

strMessage.Append("Username: " &
Request.ServerVariables("LOGON_USER"))
strMessage.Append("<br>")
strMessage.Append("IP Address: " &
Request.ServerVariables("REMOTE_ADDR"))
strMessage.Append("<br>")
strMessage.Append("User Agent: " &
Request.ServerVariables("HTTP_USER_AGENT"))
strMessage.Append("<br>")
strMessage.Append("Page: " & Request.Url.AbsoluteUri)
strMessage.Append("<br>")
strMessage.Append("Time: " & System.DateTime.Now)
strMessage.Append("<br>")
strMessage.Append("Details: " &
Server.GetLastError().InnerException.ToString())
Return strMessage.ToString

End Function

End Class

as you can see, I have it redirect to /feedback.aspx just for testing
to see if it's even running and it's not. Here's the code to create an
unhandled exception:

Dim dblTest As Double

dblTest = ""

Thanks in advance.

Alvin Bruney [MVP] wrote:
can you produce some code to clearly demonstrate the problem? you can post
here with the code once you have got it ready
>
--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
>
[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
>
>
<fu*********@gmail.comwrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
This is a strange problem. I have a project where the contents of
global.asax application_error are not firing. It is an asp.net 2.0
application using web application projects. I have another app using
web application projects and it's firing fine but it was upgraded from
the 1.1 framework.

Why doesn't my global.asax application_error routine fire?



Jul 12 '06 #11
Checked everything as per that document. It's running as NT
AUTHORITY\NETWORK SERVICE and both this account and the asp.net account
have the permissions as outlined by the document.

Still no go. What on earth could this be... and apparently I'm not the
only one as someone else posted in this thread with the same problem
and I've seen it on the web elsewhere without a resolution.

Juan T. Llibre wrote:
re:
There is something that is preventing it from firing on this particularproduction machine.

Look for permissions issues.

Make sure all the directories for the production machine have the
proper permissions for the account which ASP.NET is running as, per :

http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx

Make sure you know the correct account which
ASP.NET is running as on that machine.

If you have doubts as to which account that is, run this file :

identity.aspx:
-------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
--------

Give the permissions outlined at:
http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx
to whichever account is reported as the ASP.NEt account by "identity.aspx".

Let us know what happens...


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
I appreciate your help Juan. But again, the global.asax file fires
just fine on my development machine and on another production machine.
The code should be fine. Wouldn't you agree?

There is something that is preventing it from firing on this particular
production machine.

Juan T. Llibre wrote:
Please verify that your code conforms to accepted practices
for capturing Application Error events per these articles :

http://www.quepublishing.com/article...p?p=25171&rl=1
(includes sample code)

http://www.angrycoder.com/article.as...=2001&m=4&d=18
(includes sample code)

http://www.dotnetjohn.com/articles.aspx?articleid=42
(includes sample code)


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
Recreating the project did not work. There's something to set on the
production machine, but I can't find it. I've compared settings for
IIS, web.config, between my working development and production machines
to the new production machine and they're all the same. I've
reinstalled asp.net 2.0, I've completed all critical updates. What
else is there to try?

Anyone have any ideas? Ugh.

fu*********@gmail.com wrote:
No I haven't. I haven't gotten around to try to recreate the project
yet. That is my next step.
>
>
Mark Lewis wrote:
Did you get a resolution to this problem?
I have the same problem too. All working fine on development machine, but
Application_Error event doesn't fire on production machine. Other events are
firing okay on production machine e.g. Session_Start.

--
Mark


"fu*********@gmail.com" wrote:

I don't think that's it. I have another 2.0 application with theexact
same code and the global.asax file catches it and takes appropriate
action. Maybe I just need to recreate the project?
>
Juan T. Llibre wrote:
re:
as you can see, I have it redirect to /feedback.aspx just fortesting to see if
it's even running and it's not. Here's the code to create anunhandled exception:
Dim dblTest As Double
dblTest = ""

It seems that you're not catching the right type of exception.

Please review :

http://msdn2.microsoft.com/en-us/sys...n_members.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx




Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Sure. This is the global.asax file:
>
Imports System.Web.SessionState
Imports cti.common
Public Class Global_asax
Inherits System.Web.HttpApplication
>
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub
>
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub
>
Sub Application_BeginRequest(ByVal sender As Object, ByVale As
EventArgs)
' Fires at the beginning of each request
End Sub
>
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
As EventArgs)
' Fires upon attempting to authenticate the use
End Sub
>
Public Sub Application_Error(ByVal sender As Object, ByVale As
EventArgs)
' Fires when an error occurs
>
Dim strDeveloperEmail As String
>
Response.Redirect("/feedback.aspx")
'asldkfj
>
'If user is a developer, do Nothing, don't send e-mail, but
show error message.
If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")
>
>
CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress "), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _
>
ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))
>
Response.Redirect("/error.aspx")
End If
End Sub
>
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub
>
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub
>
Function BuildMessage() As String
>
Dim strMessage As New StringBuilder
>
strMessage.Append("Username: " &
Request.ServerVariables("LOGON_USER"))
strMessage.Append("<br>")
strMessage.Append("IP Address: " &
Request.ServerVariables("REMOTE_ADDR"))
strMessage.Append("<br>")
strMessage.Append("User Agent: " &
Request.ServerVariables("HTTP_USER_AGENT"))
strMessage.Append("<br>")
strMessage.Append("Page: " & Request.Url.AbsoluteUri)
strMessage.Append("<br>")
strMessage.Append("Time: " & System.DateTime.Now)
strMessage.Append("<br>")
strMessage.Append("Details: " &
Server.GetLastError().InnerException.ToString())
Return strMessage.ToString
>
End Function
>
End Class
>
as you can see, I have it redirect to /feedback.aspx just fortesting
to see if it's even running and it's not. Here's the code tocreate an
unhandled exception:
>
Dim dblTest As Double
>
dblTest = ""
>
Thanks in advance.
>
Alvin Bruney [MVP] wrote:
>can you produce some code to clearly demonstrate the problem? you can post
>here with the code once you have got it ready
>>
>--
>________________________
>Warm regards,
>Alvin Bruney [MVP ASP.NET]
>>
>[Shameless Author plug]
>Professional VSTO.NET - Wrox/Wiley
>The O.W.C. Black Book with .NET
>www.lulu.com/owc, Amazon
>Blog: http://www.msmvps.com/blogs/alvin
>-------------------------------------------------------
>>
>>
><fu*********@gmail.comwrote in message
>news:11**********************@g10g2000cwb.googleg roups.com...
This is a strange problem. I have a project where the contents of
global.asax application_error are not firing. It is an asp.net 2.0
application using web application projects. I have another app using
web application projects and it's firing fine but it was upgraded from
the 1.1 framework.
>
Why doesn't my global.asax application_error routine fire?
>
>
>
>
Jul 12 '06 #12
And because it's somewhat relevant, I do have customerrors turned off.
This is so I can let the global.asax handle what happens.

fu*********@gmail.com wrote:
Checked everything as per that document. It's running as NT
AUTHORITY\NETWORK SERVICE and both this account and the asp.net account
have the permissions as outlined by the document.

Still no go. What on earth could this be... and apparently I'm not the
only one as someone else posted in this thread with the same problem
and I've seen it on the web elsewhere without a resolution.

Juan T. Llibre wrote:
re:
There is something that is preventing it from firing on this particular production machine.
Look for permissions issues.

Make sure all the directories for the production machine have the
proper permissions for the account which ASP.NET is running as, per :

http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx

Make sure you know the correct account which
ASP.NET is running as on that machine.

If you have doubts as to which account that is, run this file :

identity.aspx:
-------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
--------

Give the permissions outlined at:
http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx
to whichever account is reported as the ASP.NEt account by "identity.aspx".

Let us know what happens...


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
I appreciate your help Juan. But again, the global.asax file fires
just fine on my development machine and on another production machine.
The code should be fine. Wouldn't you agree?

There is something that is preventing it from firing on this particular
production machine.

Juan T. Llibre wrote:
Please verify that your code conforms to accepted practices
for capturing Application Error events per these articles :
>
http://www.quepublishing.com/article...p?p=25171&rl=1
(includes sample code)
>
http://www.angrycoder.com/article.as...=2001&m=4&d=18
(includes sample code)
>
http://www.dotnetjohn.com/articles.aspx?articleid=42
(includes sample code)
>
>
>
>
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
Recreating the project did not work. There's something to set on the
production machine, but I can't find it. I've compared settings for
IIS, web.config, between my working development and production machines
to the new production machine and they're all the same. I've
reinstalled asp.net 2.0, I've completed all critical updates. What
else is there to try?
>
Anyone have any ideas? Ugh.
>
fu*********@gmail.com wrote:
No I haven't. I haven't gotten around to try to recreate the project
yet. That is my next step.


Mark Lewis wrote:
Did you get a resolution to this problem?
I have the same problem too. All working fine on development machine, but
Application_Error event doesn't fire on production machine. Otherevents are
firing okay on production machine e.g. Session_Start.
>
--
Mark
>
>
"fu*********@gmail.com" wrote:
>
I don't think that's it. I have another 2.0 application with the exact
same code and the global.asax file catches it and takes appropriate
action. Maybe I just need to recreate the project?

Juan T. Llibre wrote:
re:
as you can see, I have it redirect to /feedback.aspx just for testing to see if
it's even running and it's not. Here's the code to create an unhandled exception:
Dim dblTest As Double
dblTest = ""
>
It seems that you're not catching the right type of exception.
>
Please review :
>
http://msdn2.microsoft.com/en-us/sys...n_members.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
>
>
>
>
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Sure. This is the global.asax file:

Imports System.Web.SessionState
Imports cti.common
Public Class Global_asax
Inherits System.Web.HttpApplication

Sub Application_Start(ByVal sender As Object, ByVal e AsEventArgs)
' Fires when the application is started
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)
' Fires at the beginning of each request
End Sub

Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
As EventArgs)
' Fires upon attempting to authenticate the use
End Sub

Public Sub Application_Error(ByVal sender As Object, ByVal e As
EventArgs)
' Fires when an error occurs

Dim strDeveloperEmail As String

Response.Redirect("/feedback.aspx")
'asldkfj

'If user is a developer, do Nothing, don't send e-mail, but
show error message.
If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")


CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress "), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _

ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))

Response.Redirect("/error.aspx")
End If
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub

Function BuildMessage() As String

Dim strMessage As New StringBuilder

strMessage.Append("Username: " &
Request.ServerVariables("LOGON_USER"))
strMessage.Append("<br>")
strMessage.Append("IP Address: " &
Request.ServerVariables("REMOTE_ADDR"))
strMessage.Append("<br>")
strMessage.Append("User Agent: " &
Request.ServerVariables("HTTP_USER_AGENT"))
strMessage.Append("<br>")
strMessage.Append("Page: " & Request.Url.AbsoluteUri)
strMessage.Append("<br>")
strMessage.Append("Time: " & System.DateTime.Now)
strMessage.Append("<br>")
strMessage.Append("Details: " &
Server.GetLastError().InnerException.ToString())
Return strMessage.ToString

End Function

End Class

as you can see, I have it redirect to /feedback.aspx just for testing
to see if it's even running and it's not. Here's the code to create an
unhandled exception:

Dim dblTest As Double

dblTest = ""

Thanks in advance.

Alvin Bruney [MVP] wrote:
can you produce some code to clearly demonstrate the problem? you can post
here with the code once you have got it ready
>
--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
>
[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
>
>
<fu*********@gmail.comwrote in message
news:11**********************@g10g2000cwb.googlegr oups.com....
This is a strange problem. I have a project where the contents of
global.asax application_error are not firing. It is an asp.net 2.0
application using web application projects. I have another app using
web application projects and it's firing fine but it wasupgraded from
the 1.1 framework.

Why doesn't my global.asax application_error routine fire?


Jul 12 '06 #13
This may be a silly question, but does the production machine have an
ASP.NET user account? And do you see any errors in the Event Viewer
(application log, system log, etc.)?

Jul 12 '06 #14
Yes, the ASP.NET account exists and was verified against with the
permissions document Juan posted.

I think I just fixed it... and it was so simple. I'm not sure exactly
why it fixed it yet, but it's working now. I simply deleted all of the
contents of the folder and reuploaded it. There must've been some file
present that was causing the problem.

Doug wrote:
This may be a silly question, but does the production machine have an
ASP.NET user account? And do you see any errors in the Event Viewer
(application log, system log, etc.)?
Jul 12 '06 #15
Glad it's working. Chalk one up for a clean slate!

Jul 12 '06 #16
PrecompiledApp.config was the culprit. Exclude/delete this from the
project and problem is solved! Wow.

fu*********@gmail.com wrote:
Yes, the ASP.NET account exists and was verified against with the
permissions document Juan posted.

I think I just fixed it... and it was so simple. I'm not sure exactly
why it fixed it yet, but it's working now. I simply deleted all of the
contents of the folder and reuploaded it. There must've been some file
present that was causing the problem.

Doug wrote:
This may be a silly question, but does the production machine have an
ASP.NET user account? And do you see any errors in the Event Viewer
(application log, system log, etc.)?
Jul 12 '06 #17
re:
>both this account and the asp.net account have the permissions
That is a bit confusing.
They should refer to the *same* account.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@m79g2000cwm.googlegro ups.com...
Checked everything as per that document. It's running as NT
AUTHORITY\NETWORK SERVICE and both this account and the asp.net account
have the permissions as outlined by the document.

Still no go. What on earth could this be... and apparently I'm not the
only one as someone else posted in this thread with the same problem
and I've seen it on the web elsewhere without a resolution.

Juan T. Llibre wrote:
re:
There is something that is preventing it from firing on this particular production machine.

Look for permissions issues.

Make sure all the directories for the production machine have the
proper permissions for the account which ASP.NET is running as, per :

http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx

Make sure you know the correct account which
ASP.NET is running as on that machine.

If you have doubts as to which account that is, run this file :

identity.aspx:
-------------
<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = tmp
End Sub
</script>
<html>
<head>
<title>WindowsIdentity.GetCurrent.Name()</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
--------

Give the permissions outlined at:
http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx
to whichever account is reported as the ASP.NEt account by "identity.aspx".

Let us know what happens...


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
I appreciate your help Juan. But again, the global.asax file fires
just fine on my development machine and on another production machine.
The code should be fine. Wouldn't you agree?

There is something that is preventing it from firing on this particular
production machine.

Juan T. Llibre wrote:
Please verify that your code conforms to accepted practices
for capturing Application Error events per these articles :

http://www.quepublishing.com/article...p?p=25171&rl=1
(includes sample code)

http://www.angrycoder.com/article.as...=2001&m=4&d=18
(includes sample code)

http://www.dotnetjohn.com/articles.aspx?articleid=42
(includes sample code)


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
Recreating the project did not work. There's something to set on the
production machine, but I can't find it. I've compared settings for
IIS, web.config, between my working development and production machines
to the new production machine and they're all the same. I've
reinstalled asp.net 2.0, I've completed all critical updates. What
else is there to try?

Anyone have any ideas? Ugh.

fu*********@gmail.com wrote:
No I haven't. I haven't gotten around to try to recreate the project
yet. That is my next step.
>
>
Mark Lewis wrote:
Did you get a resolution to this problem?
I have the same problem too. All working fine on development machine, but
Application_Error event doesn't fire on production machine. Other events are
firing okay on production machine e.g. Session_Start.

--
Mark


"fu*********@gmail.com" wrote:

I don't think that's it. I have another 2.0 application with the exact
same code and the global.asax file catches it and takes appropriate
action. Maybe I just need to recreate the project?
>
Juan T. Llibre wrote:
re:
as you can see, I have it redirect to /feedback.aspx just for testing to see if
it's even running and it's not. Here's the code to create an unhandled exception:
Dim dblTest As Double
dblTest = ""

It seems that you're not catching the right type of exception.

Please review :

http://msdn2.microsoft.com/en-us/sys...n_members.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx
http://msdn2.microsoft.com/en-us/sys...exception.aspx




Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Sure. This is the global.asax file:
>
Imports System.Web.SessionState
Imports cti.common
Public Class Global_asax
Inherits System.Web.HttpApplication
>
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub
>
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub
>
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
EventArgs)
' Fires at the beginning of each request
End Sub
>
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e
As EventArgs)
' Fires upon attempting to authenticate the use
End Sub
>
Public Sub Application_Error(ByVal sender As Object, ByVal e As
EventArgs)
' Fires when an error occurs
>
Dim strDeveloperEmail As String
>
Response.Redirect("/feedback.aspx")
'asldkfj
>
'If user is a developer, do Nothing, don't send e-mail, but
show error message.
If User.IsInRole(ConfigurationManager.AppSettings("Do mainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupN ame")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(s AMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupN ame") & "))")
>
>
CustomSendEmail(ConfigurationManager.AppSettings(" EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress "), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _
>
ConfigurationManager.AppSettings("InternalSMTPServ erRelay"))
>
Response.Redirect("/error.aspx")
End If
End Sub
>
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub
>
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub
>
Function BuildMessage() As String
>
Dim strMessage As New StringBuilder
>
strMessage.Append("Username: " &
Request.ServerVariables("LOGON_USER"))
strMessage.Append("<br>")
strMessage.Append("IP Address: " &
Request.ServerVariables("REMOTE_ADDR"))
strMessage.Append("<br>")
strMessage.Append("User Agent: " &
Request.ServerVariables("HTTP_USER_AGENT"))
strMessage.Append("<br>")
strMessage.Append("Page: " & Request.Url.AbsoluteUri)
strMessage.Append("<br>")
strMessage.Append("Time: " & System.DateTime.Now)
strMessage.Append("<br>")
strMessage.Append("Details: " &
Server.GetLastError().InnerException.ToString())
Return strMessage.ToString
>
End Function
>
End Class
>
as you can see, I have it redirect to /feedback.aspx just for testing
to see if it's even running and it's not. Here's the code to create an
unhandled exception:
>
Dim dblTest As Double
>
dblTest = ""
>
Thanks in advance.
>
Alvin Bruney [MVP] wrote:
>can you produce some code to clearly demonstrate the problem? you can post
>here with the code once you have got it ready
>>
>--
>________________________
>Warm regards,
>Alvin Bruney [MVP ASP.NET]
>>
>[Shameless Author plug]
>Professional VSTO.NET - Wrox/Wiley
>The O.W.C. Black Book with .NET
>www.lulu.com/owc, Amazon
>Blog: http://www.msmvps.com/blogs/alvin
>-------------------------------------------------------
>>
>>
><fu*********@gmail.comwrote in message
>news:11**********************@g10g2000cwb.googleg roups.com...
This is a strange problem. I have a project where the contents of
global.asax application_error are not firing. It is an asp.net 2.0
application using web application projects. I have another app using
web application projects and it's firing fine but it was upgraded from
the 1.1 framework.
>
Why doesn't my global.asax application_error routine fire?
>
>
>
>

Jul 12 '06 #18
I'll certainly make a note of that!

Glad to know you're up and running again!

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<fu*********@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
PrecompiledApp.config was the culprit. Exclude/delete this from the
project and problem is solved! Wow.

fu*********@gmail.com wrote:
>Yes, the ASP.NET account exists and was verified against with the
permissions document Juan posted.

I think I just fixed it... and it was so simple. I'm not sure exactly
why it fixed it yet, but it's working now. I simply deleted all of the
contents of the folder and reuploaded it. There must've been some file
present that was causing the problem.

Doug wrote:
This may be a silly question, but does the production machine have an
ASP.NET user account? And do you see any errors in the Event Viewer
(application log, system log, etc.)?

Jul 12 '06 #19
Strange, I had the same error, where the events in the Global.asax.cs
were not firing. After more than a month of puzzling through this, I
eventually fixed this by including PrecompiledApp.Config on the server.

Jul 26 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Phil Lamey | last post by:
Hi All, I have the following code but for some reason I cannot get the Session_OnEnd event to fire. I am trying to limit the amount of connections a browser session can have. Where the...
0
by: Philip Townsend | last post by:
Through my research on asp.net, everything I have read states that when the framework detects changes to the global.asax file, the framework causes the application to recompile, therefore firing...
4
by: Max | last post by:
I've noticed some procedures don't run in the global.asax when you'd expect them to. I've rebuilt and set break points, but Application_Start just isn't firing today. Is there some configuration...
0
by: Mark | last post by:
There appear to be several ways to get the global error handler in global.asax.cs to fire repeatedly in a nasty endless loop. Is there a way to keep this event from firing only a handful of times...
0
by: Rick Hein | last post by:
I've got a problem with an app I've been working on, the Caching object and events not firing correctly. In a nutshell: When I'm debugging, and I set a breakpoint in the removed item call back, the...
11
by: Ron | last post by:
I have a web project compiled with the new "Web Deployment Projects" plugin for VS2005. I'm deploying the web project to one assembly and with updateable option set to ON. When I'm running the...
5
by: Eric Layman | last post by:
Hi everyone, Currently Im using Global.asax.vb to capture any errors and to send them via email to me. But I didn't get any emails when I purposely crash the web application. May I know what...
1
by: jobs | last post by:
I'm forcing an error/exception in one page as follows Protected Overrides Sub OnLoad(ByVal e As EventArgs) Dim badthing As New Exception("XXX") Throw badthing End Sub And attempting to set...
4
by: Joe | last post by:
Hello all! I added a Global.asax to my application. I'm using the Application_BeginRequest event. Everything works fine in my development enviorment but when I publish the web site the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.