Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7413587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:55:55+00:00 2026-05-29T06:55:55+00:00

I am using VS2005 C# 2.0 and SQL Server 2005. I am referring to

  • 0

I am using VS2005 C# 2.0 and SQL Server 2005.

I am referring to this guide on configuring Health Monitoring.

At the end of the guide, there will be a button on Default.aspx and on_Click of the button, a new record will be inserted into my SQL table.

However, when my button is pressed, there is no record inserted in the table.

I am unsure of what the error as there are no error messages shown, so I guess the only way is to trial and error on where I have gone wrong.

P.S. I am unable to compile MyWebEvents class library because there is no output. In my main web application, I added reference dll from the bin folder of my MyWebEvents project file. Is the DLL i referenced valid for use, or is there a step I missed in compiling?

Below are the codes which I ran, with reference to the microsoft website:


MyCriticalEvent.cs in MyWebEvents class library:

namespace MyWebEvents
{
public class MyCriticalEvent : WebAuditEvent
{
    private string userID;
    private string authType;
    private bool isAuthenticated;

    public MyCriticalEvent(string msg, object eventSource, int eventCode)
        : base(msg, eventSource, eventCode)
    {
        // Obtain the HTTP Context and store authentication details
        userID = HttpContext.Current.User.Identity.Name;
        authType = HttpContext.Current.User.Identity.AuthenticationType;
        isAuthenticated = HttpContext.Current.User.Identity.IsAuthenticated;
    }

    public MyCriticalEvent(string msg, object eventSource, int eventCode,
                           int eventDetailCode)
        : base(msg, eventSource, eventCode, eventDetailCode)
    {
        userID = HttpContext.Current.User.Identity.Name;
        authType = HttpContext.Current.User.Identity.AuthenticationType;
        isAuthenticated = HttpContext.Current.User.Identity.IsAuthenticated;
    }

    public override void FormatCustomEventDetails(WebEventFormatter formatter)
    {
        base.FormatCustomEventDetails(formatter);
        formatter.AppendLine("User ID: " + userID);
        formatter.AppendLine("Authentication Type: " + authType);
        formatter.AppendLine("User Authenticated: " +
                              isAuthenticated.ToString());
        formatter.AppendLine("Activity Description: Critical Operation");
    }
} 
}

Default.aspx.cs in Main Web Application:

public partial class _Default : System.Web.UI.Page 
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
    MyCriticalEvent testEvent = new MyCriticalEvent(
                                    "Critical Operation Performed",
                                    this,
                                    WebEventCodes.WebExtendedBase + 1);
    testEvent.Raise();
}
}

Web.config in Main Web Applicatiion:

<configuration>
    <appSettings/>
    <connectionStrings>
        <add name="MySqlConnection" connectionString="Data Source=<IP>;Initial Catalog=<DB NAME>;Persist Security Info=True;User ID=<admin username>;Password=<admin password>" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <system.web>
                <healthMonitoring enabled="true" heartbeatInterval="0">
        <bufferModes>
            <clear/>
            <add name="Logging" maxBufferSize="1000" maxFlushSize="200" urgentFlushThreshold="800" regularFlushInterval="00:05:00" urgentFlushInterval="00:01:00" maxBufferThreads="1"/>
        </bufferModes>
        <providers>
            <clear/>
            <add name="MySqlWebEventProvider" type="System.Web.Management.SqlWebEventProvider" connectionStringName="MySqlConnection" maxEventDetailsLength="1073741823" buffer="true" bufferMode="Logging"/>
        </providers>
        <eventMappings>
            <clear/>
            <add name="All Audits" type="System.Web.Management.WebAuditEvent" startEventCode="0" endEventCode="2147483647"/>
            <add name="All Errors" type="System.Web.Management.WebBaseErrorEvent" startEventCode="0" endEventCode="2147483647"/>
        </eventMappings>
        <profiles>
            <clear/>
            <add name="Audit Logs" minInstances="1" maxLimit="Infinite" minInterval="00:00:15"/>
            <add name="Error Logs" minInstances="1" maxLimit="Infinite" minInterval="00:00:15"/>
        </profiles>
        <rules>
            <clear/>
            <add name="All Audits Default" eventName="All Audits" provider="MySqlWebEventProvider" profile="Audit Logs"/>
            <add name="All Errors Default" eventName="All Errors" provider="MySqlWebEventProvider" profile="Error Logs"/>
        </rules>
    </healthMonitoring>
    </system.web>
</configuration>

enter image description here


Table in my database:

enter image description here


Error raised in the Event log if SQL Connection is broken:

The following exception was thrown by the web event provider 'MySqlWebEventProvider' in the application '/TestLogSite' (in an application lifetime a maximum of one exception will be logged per provider instance):


Problem Summary: When button1 on Default.aspx.cs is clicked, no log records were inserted in the aspnet_WebEvent_Event table.

May I know which part of my code have I gone wrong or missed out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:55:55+00:00Added an answer on May 29, 2026 at 6:55 am

    If you want to see it right away try disabling buffering

    <add name="MySqlWebEventProvider" type="System.Web.Management.SqlWebEventProvider" connectionStringName="MySqlConnection" maxEventDetailsLength="1073741823" buffer="true" bufferMode="Logging"/>
    

    change to

    <add name="MySqlWebEventProvider" type="System.Web.Management.SqlWebEventProvider" connectionStringName="MySqlConnection" maxEventDetailsLength="1073741823" buffer="false" bufferMode="Logging"/>
    

    This should stop the delay caused by buffering and you should see the rows appear right away.

    Plus you may want to decrease your minInterval on the profiles to something quick like “00:00:01” 🙂

    You can read more about buffering here:

    http://msdn.microsoft.com/en-us/library/ms178708%28v=vs.80%29.aspx

    On a live system it maybe a good idea to leave buffering in place in case you think your SQL server might get overloaded with lots of events firing.

    OR

    Ive found i can force it save to the log by:

    1 : start your project in visual studio
    2 : click the button
    3 : Stop the project and then start it again
    4 : Check in the database you should see an event logged

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using VS2005 C# .NET 2.0 and SQL Server 2005. Are there any
I am using VS2005 and SQL Server 2005. I am trying to execute multiple
I am using VS2005 and SQL Server 2005. I am trying to execute multiple
I am using VS2005 C# and SQL Server 2005. Currently I am able to
I am using VS2005 C# and SQL Server 2005. I am currently doing an
I am using VS2005 C# and SQL Server 2005. I have a SQL Query
I am using VS2005 C# and SQL Server 2005. I am currently using user
I am using VS2005 C# and SQL Server 2005. I have a GridView and
I am using VS2005 C# and SQL Server 2005. I have an Excel file
I am using VS2005 C# and SQL Server 2005. I want to form an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.