Advertisement

09.24.2007 at 10:54AM PDT, ID: 22848990
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.2

Error handler is not being triggered in global.asax.vb. VS 2005 SQL Server 2005

Asked by Dovberman in Programming for ASP.NET, MS SQL Server

Tags: , ,

Error handler is not being triggered in global.asax.vb. VS 2005 SQL Server 2005

The breakpoint in the event handler was not tirggered during debug.

For clarification, here is my code:

Global.asax

<%@ Application Language="VB" Codebehind="Global.asax.vb"  %>

Global.asax.vb

Imports System.Web
Imports System.Net.Mail
Imports System.Text
Imports System.Web.SessionState
Imports System.Diagnostics
Imports System.Exception

Public Class Global1
    Inherits System.Web.HttpApplication

#Region " Component Designer Generated Code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Required by the Component Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Component Designer
    'It can be modified using the Component Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        components = New System.ComponentModel.Container()
    End Sub

#End Region

    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application is started
    End Sub

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the session is started
    End Sub

    Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires at the beginning of each request
    End Sub

    Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires upon attempting to authenticate the use
    End Sub

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

        Dim ErrorDescription As String = Server.GetLastError().ToString
        'Creation of event log if it does not exist
        Dim EventLogName As String = "ErrorSample"
        If (Not EventLog.SourceExists(EventLogName)) Then
            EventLog.CreateEventSource(EventLogName, EventLogName)
        End If
        ' Inserting into event log
        Dim Log As New EventLog
        Log.Source = EventLogName
        Log.WriteEntry(ErrorDescription, EventLogEntryType.Error)

        Dim objClient As New SmtpClient
        Dim objEMail As New MailMessage

        Dim strErrorMessage As String = _
        "The error description is as follows : " _
        & Server.GetLastError().ToString()

        'Try
        Dim msg1 As New System.Net.Mail.MailMessage
        objEMail.From = New MailAddress("dovberman@cableone.net")
        objEMail.To.Add(New MailAddress("dmartin@reslinker.com"))
        objEMail.Subject = "My Stock Picker Error Report"
        objEMail.Body = strErrorMessage
        'objEMail.Body = BuildMessage()
        'objEMail.AlternateViews
        msg1.Priority = MailPriority.Normal
        objClient.Host = "localhost"
        Try
            objClient.Send(objEMail)
            Response.Write("Your E-mail has been sent sucessfully")
        Catch ex As Exception
            Response.Write("Send failure: " + ex.ToString())
        End Try
    End Sub

    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the session ends
    End Sub

    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application ends
    End Sub

--------
Error that should be handled

xxx.asax file

<tr>    
    <td align=left colspan=1 style="height: 15px; width: 200px;" valign="top">
        <asp:GridView ID="grdMarket" runat="server"  AutoGenerateColumns="False"
            DataKeyNames="MarketID"
            DataSourceID="dscMarket" Caption="Select a Market">
            <Columns>
                <asp:CommandField ShowSelectButton="True" ButtonType="Button" />
                <asp:BoundField DataField="MarketName" HeaderText="Market Name" SortExpression="MarketName" />
                <asp:BoundField DataField="MarketID" HeaderText="MarketID" ReadOnly="True" SortExpression="MarketID" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="dscMarket" runat="server" ConnectionString="<%$ ConnectionStrings:StockSelectConnectionString %>"
            ProviderName="System.Data.SqlClient"
            SelectCommand="SELECT [MarketName], [MarketID] FROM [Market1] ORDER BY [MarketID]">
        </asp:SqlDataSource>

'Market1 is not the correct table name.
The error was displayed the normal way during debug and never got sent to the error handler.

Any ideas would be appreciated.
Start Free Trial
[+][-]09.24.2007 at 11:46AM PDT, ID: 19950620

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.24.2007 at 12:15PM PDT, ID: 19950899

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.24.2007 at 12:36PM PDT, ID: 19951100

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.08.2007 at 12:11PM PDT, ID: 20036237

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.08.2007 at 12:24PM PDT, ID: 20036329

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.21.2007 at 02:56PM PDT, ID: 20119421

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Programming for ASP.NET, MS SQL Server
Tags: error, picker, using
Sign Up Now!
Solution Provided By: Dovberman
Participating Experts: 2
Solution Grade: B
 
 
[+][-]12.13.2007 at 07:25AM PST, ID: 20464836

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.14.2007 at 04:43AM PST, ID: 20471154

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080924-EE-VQP-39 / EE_QW_1_20070628