Export (0) Print
Expand All

TemplatedMailWebEventProvider Class

Implements an event provider that uses templates to define and format e-mails it sends for event notifications.

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

public sealed class TemplatedMailWebEventProvider : MailWebEventProvider

The TemplatedMailWebEventProvider type exposes the following members.

  NameDescription
Public propertyBufferModeGets a value indicating the buffering mode used by the provider. (Inherited from BufferedWebEventProvider.)
Public propertyStatic memberCurrentNotificationGets the event notification object that provides the event information used by the e-mail template.
Public propertyDescriptionGets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs). (Inherited from ProviderBase.)
Public propertyNameGets the friendly name used to refer to the provider during configuration. (Inherited from ProviderBase.)
Public propertyUseBufferingGets a value indicating whether the provider is in buffered mode. (Inherited from BufferedWebEventProvider.)
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodFlushMoves the events from the provider's buffer into the event log. (Inherited from BufferedWebEventProvider.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeInfrastructure. Sets the initial values for this object. (Overrides MailWebEventProvider.Initialize(String, NameValueCollection).)
Public methodProcessEventProcesses the event passed to the provider. (Inherited from MailWebEventProvider.)
Public methodProcessEventFlushRemoves all events from the provider's buffer. (Inherited from MailWebEventProvider.)
Public methodShutdownPerforms tasks associated with shutting down the provider. (Inherited from MailWebEventProvider.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

ASP.NET health monitoring allows production and operations staff to manage deployed Web applications. The System.Web.Management namespace contains the health event types responsible for packaging application health-status data and the provider types responsible for processing this data. It also contains supporting types that help during the management of health events.

This class is not intended to be used from your code. It is created, configured, and used by the ASP.NET health-monitoring system to send event notifications by e-mail. You can define an e-mail Web event provider in a configuration file, as demonstrated in the Example section of this topic. In addition, you can configure the providers section programmatically by accessing the HealthMonitoringSection.Providers property.

The e-mail this class produces is defined and formatted using a template. This template consists of markup code defined in a standard .aspx file that outputs the text for the message body. The event information used by the template is provided by a MailEventNotificationInfo object that is available from the static CurrentNotification property of this class.

This provider has a comprehensive set of configuration attributes that you can use to customize the way it works.

TopicLocation
How to: Send E-mail for Health Monitoring NotificationsBuilding ASP .NET Web Applications
How to: Send E-mail for Health Monitoring NotificationsBuilding ASP .NET Web Applications

The following example is a configuration file excerpt that shows how to specify a provider of type SimpleMailWebEventProvider in the <healthMonitoring> section The <add> elements in the <rules> section specify that the provider will handle request-processing errors and infrastructure errors.

<system.web>
  <healthMonitoring
    enabled="true"
    heartBeatInterval="0">
    <bufferModes>
      <add name="Critical Notification"
        maxBufferSize="100"
        maxFlushSize="20"
        urgentFlushThreshold="1"
        regularFlushInterval="Infinite"
        urgentFlushInterval="00:01:00"
        maxBufferThreads="1"
      />
    </bufferModes>
    <providers>
      <add name="CriticalMailEventProvider"
        type="System.Web.Management.TemplatedMailWebEventProvider, 
        System.Web, Version=%ASSEMBLY_VERSION%, Culture=neutral, 
        PublicKeyToken=%MICROSOFT_PUBLICKEY%"
        template="../mailtemplates/critical.aspx"
        from="sender address"
        to="someone@example.com" 
        cc="someone@example.com"
        bcc="someone@example.com"
        priority="High"
        bodyHeader="Warning!"
        bodyFooter="Please investigate ASAP."
        subjectPrefix="Action required."
        buffer="true"
        bufferMode="Critical Notification"
        maxEventLength="4096"
        maxSize="4096"
        maxMessagesPerNotification="1"
      />
    </providers>
    <eventMappings>
      <add name="Request Processing Events"
        type="System.Web.Management.WebRequestEvent, System.Web", 
        Version=%ASSEMBLY_VERSION%, Culture=neutral, 
        PublicKeyToken=%MICROSOFT_PUBLICKEY%" 
      />
      <add name="Infrastructure Errors"
        type="System.Web.Management.WebErrorEvent, System.Web, 
        Version=%ASSEMBLY_VERSION%, Culture=neutral, 
        PublicKeyToken=%MICROSOFT_PUBLICKEY%" 
      />
    </eventMappings>
    <profiles>
      <add name="Default"
        minInstances="1"
        maxLimit="Infinite"
        minInterval="00:10:00"
      />
      <add name="Critical"
        minInstances="1"
        maxLimit="1024"
        minInterval="00:00:00"
      />
    </profiles>
    <rules>
      <add name="Request Processing Errors"
        eventName="Request Processing Errors"
        provider="CriticalMailEventProvider"
        profile="Default"
      />
      <add name="Infrastructure Notifications"
        eventName="Infrastructure Errors"
        provider="CriticalMailEventProvider"
        profile="Critical"
      />
    </rules>
  </healthMonitoring> 
</system.web>

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft