Re: Global.asax not firing
- From: Mark Lewis <marklewis@xxxxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 05:57:02 -0700
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
"furiousmojo@xxxxxxxxx" 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/system.web.httpunhandledexception_members.aspx
http://msdn2.microsoft.com/en-us/system.web.httpunhandledexception.aspx
http://msdn2.microsoft.com/en-us/system.web.httpexception.aspx
http://msdn2.microsoft.com/en-us/system.web.httpcompileexception.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/
===================================
<furiousmojo@xxxxxxxxx> wrote in message
news:1150893701.255923.84280@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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("DomainName")
& "\" & ConfigurationManager.AppSettings("DevelopersGroupName")) = True
Then
'Otherwise just send e-mail and redirect to a friendly
page.
Else
strDeveloperEmail =
GetADEmailsOfGroupMembers("(&(ObjectClass=group)(sAMAccountName=" &
ConfigurationManager.AppSettings("DevelopersGroupName") & "))")
CustomSendEmail(ConfigurationManager.AppSettings("EmailFromName"), _
ConfigurationManager.AppSettings("EmailFromAddress"), _
strDeveloperEmail, _
"", _
"Portal Application Error", _
BuildMessage(), _
"Normal", _
ConfigurationManager.AppSettings("InternalSMTPServerRelay"))
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
-------------------------------------------------------
<furiousmojo@xxxxxxxxx> wrote in message
news:1150810068.235313.182510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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?
- Follow-Ups:
- Re: Global.asax not firing
- From: furiousmojo@xxxxxxxxx
- Re: Global.asax not firing
- References:
- Global.asax not firing
- From: furiousmojo
- Re: Global.asax not firing
- From: Alvin Bruney [MVP]
- Re: Global.asax not firing
- From: furiousmojo@xxxxxxxxx
- Re: Global.asax not firing
- From: Juan T. Llibre
- Re: Global.asax not firing
- From: furiousmojo@xxxxxxxxx
- Global.asax not firing
- Prev by Date: Re: Sorting when the page is loaded the first time
- Next by Date: Re: If no ASPNET user account, can I use Global.asax for application-level error trapping?
- Previous by thread: Re: Global.asax not firing
- Next by thread: Re: Global.asax not firing
- Index(es):
Relevant Pages
|
Loading