Exception mailer usage and configuration

Configuration

Register configuration section

Include the following section registration in your web.config file:
<configSections>
    <sectionGroup name="altairis.web">
        <section name="management" type="Altairis.Web.Management.Configuration.ManagementSection, Altairis.Web.Management"/>
    </sectionGroup>
</configSections>

Register HTTP module

Register the ErrorHandlingModule HTTP module (used also by error page handling, so register it only once):
<system.webServer>
    <modules>
        <add name="ErrorHandlingModule" type="Altairis.Web.Management.ErrorHandlingModule, Altairis.Web.Management" />
    </modules>
</system.webServer>

Configure general mailing options

Altairis Web Management Toolkit honors application-wide mailing settings in the system.net/mailSettings/smtp section. The following is sample configuration (use both specifiedPickupDirectory and network elements, even when pickup is used to prevent the The SMTP host was not specified. error).
<system.net>
    <mailSettings>
        <smtp deliveryMethod="SpecifiedPickupDirectory">
            <specifiedPickupDirectory pickupDirectoryLocation="C:\InetPub\MailRoot\pickup"/>
            <network host="localhost"/>
        </smtp>
    </mailSettings>
</system.net>

Configure the exception mailing

This is minimal configuration to get the exception mailing up and running - enable it and specify sender and receiver e-mail addresses:
<altairis.web>
    <management>
        <exceptionMailer enabled="true" mailSenderAddress="sender@domain" mailRecipientAddress="recipient@domain" />
    </management>
</altairis.web>
Possible attributes of the exceptionMailer element:
Name Default value Description
enabled false Set to true to enable exception mailer.
excludeLocalRequests true Ignore requests coming from the same computer (useful for development).
excludeSystemUrls true Ignore requests to system URLs, like WebResource.axd and so on.
mailRecipientAddress mandatory E-mail address of recipient of error e-mail messages.
mailSenderName hostname Display name of originator of error e-mail messages.
mailSenderAddress mandatory E-mail address of originator of error e-mail messages.
maximumSubjectLength 50 Maximum length of subject string (derived from error message), 10-200 characters.

Ignored exceptions

The mailer ignores the following exception types, since they usually do not represent real error in application:
  • HttpRequestValidationException - "A potentially dangerous value was detected from the client..."
  • ViewStateException - invalid viewstate
  • HttpException - HTTP error, such as 404 on .aspx file

Last edited Jul 4, 2011 at 12:35 AM by altair, version 2

Comments

No comments yet.