SYMPTOMS
When you view a compiled WebClass (Internet Information Server application) in a Web browser, you may receive the following error message:
projectname error '800a9c68'
Application-defined or object-defined error
/projectname/pagename.ASP, line 13
RESOLUTION
To resolve this problem, you can read the application log and extract the error message. To do this on Microsoft Windows NT 4.0, perform the following steps:
- From the Start menu, point to Programs, point to Administrative Tools, and then click Event Viewer.
- In the Event Viewer window, on the Log menu, click Application.
- To view the logs, double-click the entries in the list.
The first log is an error that is generated by the WebClassRuntime and contains the following text:
The WebClass runtime trapped the following error:
Source: WebClass1
Thread ID: 1256
Description: Application-defined or object-defined error
The second log is a warning from the VBRuntime and contains the actual error message:
The VB Application identified by the event source logged this Application
Project1:
ThreadID: 354,
Logged: MsgBox: ,Run-Time error '11':
Division by zero
NOTE: Microsoft Windows 2000 does not report the actual error in the event log. To find the actual error message, you must create your own error handling in your WebClass procedures. This is also recommended for WebClasses on Windows NT so that you can produce custom error messages for your customers instead of the generic "Application-defined or object-defined error." In addition, to make sure that you catch all errors, you should implement an error handler in all of your WebClass methods.
To implement error handling in WebClasses, use the following sample code:
Private Sub WebClass_Start()
On Error GoTo ErrorHandler
...
Your code goes here
...
ErrorHandler:
app.logEvent "error in method WebClass_Start: " & Err.Number & " " & Err.Description
Select case Err.Number
Case 11
Response.Write "<B>Your custom error message ...</B>"
Case Else
Response.Write "<B>Your generic error message ...</B>"
End Sub
The
App.LogEvent method creates an event log in the application log of the Web server. The source is the name of your WebClass.
REFERENCES
For additional information, click the article numbers below
to view the articles in the Microsoft Knowledge Base:
189539 INFO: VB 6.0 Readme Part 8: WebClass Designer Issues
269797 HOWTO: Create Error Handlers in Visual Basic COM Components