RTT Posted April 4, 2005 Posted April 4, 2005 i want to make it so, that when an error accurs, the people get redirected to an error page, and that the error is being send to me. in the web.config file i added: <customErrors defaultRedirect="error.htm" mode="RemoteOnly" /> in the global.asax i added: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) 'Fires when an error occurs sendmail(Server.GetLastError) End Sub with the function: Dim mail As New MailMessage mail.To = """name"" <email@email.com>" mail.From = """ Error "" <email@email.com>" mail.BodyFormat = MailFormat.Html mail.Priority = MailPriority.High mail.Subject = "Error Report - " & Date.Now.ToString mail.Body = "" mail.Body += "<u><b>ErrorMessage:</b></u><br>" mail.Body += Ex.Message.ToString & "<br><br>" mail.Body += "<b>exception: </b>" & ex.ToString mail.Body += "<br><br><b>Reported on: </b>" & Date.Now.ToString SmtpMail.SmtpServer = "BEXXGHE01IS0020" SmtpMail.Send(mail) it works, i get an email when an error accurs and the user is redirected, but i always get something like this: ErrorMessage: Exception of type System.Web.HttpUnhandledException was thrown. exception: System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.IndexOutOfRangeException: There is no row at position 4. at System.Data.DataRowCollection.get_Item(Int32 index) at ResourcesManagement1.containersOverview.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\ResourcesManagement1\Asp\containersOverview.aspx.vb:line 68 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain() --- End of inner exception stack trace --- at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain() at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Reported on: 04/04/2005 11:05:57 the error is always of the type System.Web.HttpUnhandledException, while i know the error should be of other types. anybody who knows what causes this and how to solve it? Quote
stustarz Posted April 4, 2005 Posted April 4, 2005 Well the actual exception is of type: System.IndexOutOfRangeException, being caused by a datarow trying to read a row at position 4 - which it isnt finding. The answers to your questions are all in the exception message you have posted :) In order to solve this, modify your code to stop trying to read rows which dont exist, if you arent sure whats happening there, then post the code which is actually throwing the exception so we can take it from there Quote Visit: VBSourceSeek - The VB.NET sourcecode library "A mere friend will agree with you, but a real friend will argue."
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.