Why doesn't my global.asax application_error routine fire?
--
________________________
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
-------------------------------------------------------
<furio...@gmail.com> wrote in message
news:1150810068.2...@g10g2000cwb.googlegroups.com...
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.
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/
===================================
<furio...@gmail.com> wrote in message
news:1150893701....@i40g2000cwc.googlegroups.com...
--
Mark
Anyone have any ideas? Ugh.
http://www.quepublishing.com/articles/article.asp?p=25171&rl=1
(includes sample code)
http://www.angrycoder.com/article.aspx?cid=5&y=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/
===================================
<furio...@gmail.com> wrote in message
news:1152716614.5...@s13g2000cwa.googlegroups.com...
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/
===================================
<furio...@gmail.com> wrote in message
news:1152726400....@i42g2000cwa.googlegroups.com...
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.
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.
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/
===================================
<furio...@gmail.com> wrote in message
news:1152729855....@m79g2000cwm.googlegroups.com...
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/
===================================
<furio...@gmail.com> wrote in message
news:1152732171.8...@i42g2000cwa.googlegroups.com...