J
Joost
Hello all,
I am currently developping an intranet website for my company and I
encountered a strange thing.
I have a global error handler (application_error) in my global.asax
file which should handle all the unhandled exceptions. The strange
thing is, it only catches unhandled exceptions sometimes! One time it
catches the errors and executes the code in the sub and sometimes the
browser just displays a standard error page(asp default error page).
Sqlexceptions are mostly handled by the application_error(but not
always!?) but, other exceptions, like a system.overflowexception, are
not caught or handled by the application_error.
My web.config for customerrors
<customErrors mode="RemoteOnly">
</customErrors>
My application_error sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim objMail As New Mail.MailMessage
objMail.BodyFormat = MailFormat.Html
objMail.Priority = MailPriority.High
objMail.From = Session("email")
objMail.To = ####
objMail.Body = ####
SmtpMail.SmtpServer = Session("smtp")
SmtpMail.Send(objMail)
Context.ClearError()
Response.Redirect("/inbev/errorpage.aspx")
End Sub
I don't have a page_error sub in any file and other errors are caught
within try-catch blocks.
All pages inherit for a custom class which inherits from
system.web.ui.page, the class definition is below :
Public Class BasePage : Inherits System.Web.UI.Page
Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
Me.Controls.AddAt(0, LoadControl("Header.ascx"))
MyBase.OnInit(e)
Me.Controls.Add(LoadControl("Footer.ascx"))
End Sub
End Class
Public Class BaseControl : Inherits System.Web.UI.UserControl
Public Shadows ReadOnly Property Page() As BasePage
Get
Return CType(MyBase.Page, BasePage)
End Get
End Property
End Class
Thanks in advance,
I am currently developping an intranet website for my company and I
encountered a strange thing.
I have a global error handler (application_error) in my global.asax
file which should handle all the unhandled exceptions. The strange
thing is, it only catches unhandled exceptions sometimes! One time it
catches the errors and executes the code in the sub and sometimes the
browser just displays a standard error page(asp default error page).
Sqlexceptions are mostly handled by the application_error(but not
always!?) but, other exceptions, like a system.overflowexception, are
not caught or handled by the application_error.
My web.config for customerrors
<customErrors mode="RemoteOnly">
</customErrors>
My application_error sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim objMail As New Mail.MailMessage
objMail.BodyFormat = MailFormat.Html
objMail.Priority = MailPriority.High
objMail.From = Session("email")
objMail.To = ####
objMail.Body = ####
SmtpMail.SmtpServer = Session("smtp")
SmtpMail.Send(objMail)
Context.ClearError()
Response.Redirect("/inbev/errorpage.aspx")
End Sub
I don't have a page_error sub in any file and other errors are caught
within try-catch blocks.
All pages inherit for a custom class which inherits from
system.web.ui.page, the class definition is below :
Public Class BasePage : Inherits System.Web.UI.Page
Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
Me.Controls.AddAt(0, LoadControl("Header.ascx"))
MyBase.OnInit(e)
Me.Controls.Add(LoadControl("Footer.ascx"))
End Sub
End Class
Public Class BaseControl : Inherits System.Web.UI.UserControl
Public Shadows ReadOnly Property Page() As BasePage
Get
Return CType(MyBase.Page, BasePage)
End Get
End Property
End Class
Thanks in advance,