Click or drag to resize

ErrorModule Class

Represents an HTTP module that can be used to handle exceptions globally in Web Sites and Web Services.
Inheritance Hierarchy
SystemObject
  GSF.ErrorManagementErrorModule

Namespace: GSF.ErrorManagement
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
public class ErrorModule : IHttpModule
View Source

The ErrorModule type exposes the following members.

Constructors
 NameDescription
Public methodErrorModuleInitializes a new instance of the ErrorModule class
Top
Properties
 NameDescription
Public propertyStatic memberCode exampleLogger Gets the ErrorLogger object used by the ErrorModule object for logging exceptions.
Top
Methods
 NameDescription
Public methodDispose Disposes the resources (other than memory) used by the ErrorModule.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodInit Initializes the ErrorModule and prepares it to handle requests.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Example
Below is the config file entry required for enabling error handling using ErrorModule:
C#
<configuration>
  <system.web>
    <httpModules>
      <add name="ErrorModule" type="GSF.ErrorManagement.ErrorModule, GSF.Core" />
    </httpModules>
  </system.web>
</configuration>
Below is the config file entry required for changing the settings of Logger:
C#
<configuration>
  <configSections>
    <section name="categorizedSettings" type="GSF.Configuration.CategorizedSettingsSection, GSF.Core" />
  </configSections>
  <categorizedSettings>
    <errorLogger>
      <add name="LogToUI" value="False" description="True if an encountered exception is to be logged to the User Interface; otherwise False."
        encrypted="false" />
      <add name="LogToFile" value="True" description="True if an encountered exception is to be logged to a file; otherwise False."
        encrypted="false" />
      <add name="LogToEmail" value="False" description="True if an email is to be sent to ContactEmail with the details of an encountered exception; otherwise False."
        encrypted="false" />
      <add name="LogToEventLog" value="True" description="True if an encountered exception is to be logged to the Event Log; otherwise False."
        encrypted="false" />
      <add name="LogToScreenshot" value="False" description="True if a screenshot is to be taken when an exception is encountered; otherwise False."
        encrypted="false" />
      <add name="SmtpServer" value="smtp.email.com" description="Name of the SMTP server to be used for sending the email messages."
        encrypted="false" />
      <add name="ContactEmail" value="" description="Comma-seperated list of recipient email addresses for the email message."
        encrypted="false" />
      <add name="ContactName" value="" description="Name of the person that the end-user can contact when an exception is encountered."
        encrypted="false" />
      <add name="ContactPhone" value="" description="Phone number of the person that the end-user can contact when an exception is encountered."
        encrypted="false" />
      <add name="HandleUnhandledException" value="True" description="True if unhandled exceptions are to be handled automatically; otherwise False."
        encrypted="false" />
      <add name="ExitOnUnhandledException" value="False" description="True if the application must exit when an unhandled exception is encountered; otherwise False."
        encrypted="false" />
    </errorLogger>
  </categorizedSettings>
</configuration>
See Also