By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,930 Members | 1,389 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,930 IT Pros & Developers. It's quick & easy. exception handling error

P: n/a
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">

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")
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, 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"))
End Sub
End Class

Public Class BaseControl : Inherits System.Web.UI.UserControl
Public Shadows ReadOnly Property Page() As BasePage
Return CType(MyBase.Page, BasePage)
End Get
End Property
End Class

Thanks in advance,
Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.