asp.net/vb.net exception handling error

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top