This documentation is archived and is not being maintained.

WebEventProvider.Flush Method

Moves the events from the provider's buffer into the event log.

Namespace:  System.Web.Management
Assembly:  System.Web (in System.Web.dll)

public abstract void Flush()

When this method is called, all the events in the buffer are immediately moved from the buffer to the event log, regardless of how much time has elapsed since last write or how many events are in the buffer. The time of the last write is reset to the time of the flushing action.

The following code example shows how to use the Flush method.

// Flush the input buffer if required.
public override void Flush()
    // Create a string builder to 
    // hold the event information.
    StringBuilder reData = new StringBuilder();

    // Store custom information.
    reData.Append("SampleEventProvider processing." +
    reData.Append("Flush done at: {0}" +
        DateTime.Now.TimeOfDay.ToString() +

    foreach (WebBaseEvent e in msgBuffer)
        // Store event data.

    // Store the information in the specified file.
    StoreToFile(reData, logFilePath, FileMode.Append);

    // Reset the message counter.
    msgCounter = 0;

    // Clear the buffer.


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.