The following is an excerpt of a configuration file showing how to configure the EventLogWebEventProvider to capture view-state failures. For completeness we are showing the setup for the provider and eventMappings sections. They are already set by default. The only thing you need to do is to provide the setup for the rules section. Refer to healthMonitoring for more information.
To generate a view-state error, enter a URL in your browser with the following query string:
?__VIEWSTATEFIELDCOUNT=1&__VIEWSTATE=bogus
The Windows Application Eventlog will capture a view-state failure, if you enter the following configuration settings.
<healthMonitoring
enabled="true"
heartBeatInterval="0">
<providers>
// Configure the provider to process
// the health events.
<add name="EventLogProvider"
type="System.Web.Management.EventLogWebEventProvider,
System.Web,Version=2.0.3600.0,Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
<eventMappings>
<clear />
// Configure the WebFailureAuditEvent
// object to handle the Viewstate failures.
<add name="Failure Audits"
type="System.Web.Management.WebFailureAuditEvent,
System.Web,Version=2.0.3600.0,Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</eventMappings>
<rules>
<clear/>
// Configure the connection between the
// application lifetime event object
// and the provider that must process it.
<add name="Viewstate Failure Events "
eventName="Failure Events"
provider="EventLogProvider"
profile="Default"
minInterval="00:01:00" />
</rules>
</healthMonitoring>