aspNetEmail

EmailMessage.SendASPNETException Method (ServerErrorSection[])

Formats and sends the base ASP.NET exception. Useful to administrators and developers who monitor their applications.

public static void SendASPNETException(
   params ServerErrorSection[] sections
);

Parameters

sections
Server Error Sections to include in the Email

Remarks

The properties for the EmailMessage object are loaded from the web.config.

Example

[web.config]
            <?xml version="1.0" encoding="utf-8" ?>
            <configuration>
            <appSettings>
            <add key="EmailMessage.To" value="webmaster@mycompany.com"></add>
            <add key="EmailMessage.FromAddress" value="webmaster@mycompany.com"></add>
            <add key="EmailMessage.Server" value="127.0.0.1"></add>
            <add key="EmailMessage.Subject" value="error in asp.net app"></add>
            <add key="EmailMessage.BodyFormat" value="html"></add>
            </appSettings>
            
            <system.web>
            
            </system.web>
            </configuration>
            
            
[C#]
            
            //send any exception that occurrs based upon web.config settings
            EmailMessage.SendASPNETException( ServerErrorSection.Exception, ServerErrorSection.ServerVariables );
            
            
[Visual Basic]
            
            'send any exception that occurrs based upon web.config settings
            EmailMessage.SendASPNETException( ServerErrorSection.Exception, ServerErrorSection.ServerVariables )
            
            

See Also

EmailMessage Class | aspNetEmail Namespace | EmailMessage.SendASPNETException Overload List | LoadFromConfig