Error Handling Options

Topic updated 4-7-2007

The Error Handling Template has the following options:

ErrorHandlingOptions

General

Redirect to Errorpage aftwerwards
After the error has been logged redirect to the errorpage. This is the page that the user will see.

Add a database logging implementation
Log the errors to a database table. you will have to map The BO-layer class and properties according to the contents. In the picture above you see an example of the logging to a table called LogItems. Alls properties are mapped. This is not a requirement. at least one property needs to be mapped. You can have your own table. Below you will find an example script for creating the table in Ms-sql Server

Add a text logging implementation
Log to a text file. you will have to give the file a name.

Add an event logging implemenation
Log the error to the windows NT eventlog. Be careful the ASP.net process needs to have privileges to do so. You have to set the userName in the processModel section in machine.config (%windir%\Microsoft.NET\Framework\v1.0.3705\CONFIG) to SYSTEM, otherwise you have no permission to access the event log.

Email the exception
Email the exception to the given Email address.

You can use all logging options simultaneously, however one or two options should normally suffice.

 

Log Object

Include the ViewState
Logging the ViewState is turned off by default. This information is not very useful in most cases.

 

Example script for database logging

The SQL Script for Microsoft SQL Server to create the LogItems table looks as following:

   CREATE TABLE LogItems

   (

       EventId      int IDENTITY(1, 1) NOT NULL,

       LogDateTime  datetime NULL,

       Source       char(100) NULL,

       Message      varchar(1000) NULL,

       Form         varchar(3000) NULL,

       QueryString  varchar(1000) NULL,

       TargetSite   varchar(300) NULL,

       StackTrace   varchar(3000) NULL,

       Referer      varchar(250) NULL

   )