The WebErrorHandler class provides error handling, exception parsing, display and logging of errors. As such this method can be used as a worker method from global.asax's Application_Error and can provide just about all of the ErrorLog management features for logging, display and clearing the log.
Although this class lacks email support it is easy to provide this with the wwIPStuff.wwSMTP class and by using the ToString() method to retrieve the error message for the message body. In the Web Store the WebStoreUtils.SendAdminEmail method handles this operation more cleanly by pulling the admin information from the store's configuration.
Namespace: Westwind.Tools
Assembly: wwutils.dll
Inherits: Object
Dependencies:
wwIPStuff for SendEmail method
WebRequestLog for SQL Logging
Class Members
Member | Description | |
---|---|---|
Browser |
The client's browser string. | |
CompactFormat |
If true returns only the error message and URL. | |
ContentSize |
The size of the POST buffer if data was posted. | |
ErrorMessage |
The runtime error message thrown by the application. | |
FullUrl |
The completely qualified Url to this request. | |
IPAddress |
The client's IP address | |
LogFileName |
Name of the logfile. Filename is relative to the virtual Web root. | |
Login |
The username of the user attached if the user is authenticated. | |
PostBuffer |
Content of the POST buffer if the page was posted. The size is limited to 2k. Larger buffers are stripped. | |
QueryString |
The complete querystring. | |
RawUrl |
The raw Web relative URL that caused this exception to occur. | |
Referer |
The referring Url that was used to access the current page that caused the error. | |
RetrieveSourceLines |
Determines whether the routines attempt to retrieve Source Code lines. | |
SourceCode |
The source code if available for the error that occurred. The code will include the 5 surrounding lines before and after. | |
StackTrace |
Stack trace listing as available from the runtime compiler | |
Time |
The time the error was logged. | |
ClearLog |
Tries to delete the XML log file. public Boolean ClearLog() |
|
LogErrorToSql |
Logs the request in question to a SQL database. You pass in the connection information and the request will be logged into the log table. o.LogErrorToSql(string ConnectionString) |
|
LogErrorToXml |
Logs an error to the XML file specified in the LogFileName property. Logs with XML Elements. o.WebErrorHandler.LogErrorToXml() public Boolean LogErrorToXml(Boolean LogAsString) |
|
ShowXmlLog |
A fullly self contained log display routine for the XML log that loads the log from the disk file and displays it. The log is displayed in raw XML format with first errors first. public Boolean ShowLog() |
|
WebErrorHandler |
Constructor for the class that requires that an Exception object is passed in. The Exception is required for any Parse operations to occur (ToString(), LogError()). o.WebErrorHandler(Exception LastError) o.WebErrorHandler() |
© West Wind Technologies, 1996-2018 • Updated: 11/29/03
Comment or report problem with topic