Sub Application_Error(ByVal sender As Object, _ ByVal e As EventArgs) ' Get the actual error that brought us here Dim ex As Exception = _ Server.GetLastError.InnerException ' Display basic error information Response.Write("An error occurred in the application:<br>") Response.Write(ex.Message & "<br>") Response.Write("Stack trace:<br>") Dim s As StringBuilder = New StringBuilder(ex.StackTrace) Response.Write(s.Replace(" at ", " at<br> ")) Response.End() ' Clear the error Server.ClearError() End Sub |