Visual Basic Concepts
Like a form-based application, a webclass is initialized and destroyed, although these events are fired differently than they are for a form. In addition, a webclass has several other events that mark stages in its life, indicating when the browser displays the first webitem and when requests are received and processed.
These are the key events in the life of a webclass:
Note If the StateManagement property for the webclass is set to wcNoState, the webclass fires the Initialize event each time it receives an HTTP request. See "State Management in IIS Applications" for more information about setting the StateManagement property.
Note If the end user specifies a webitem and event in the initial URL they use to launch the application, the webclass does not fire the Start event. In this case, the specified event would be the first event fired. See "Setting the Start Event" for more information.
Note If the StateManagement property for the webclass is set to wcNoState, the webclass fires the Terminate event each time it sends a response to the browser. If the StateManagement property for the webclass is set to wcRetainInstance, the webclass fires the Terminate event only after it calls the ReleaseInstance method. See "State Management in IIS Applications" for more information about setting the StateManagement property.
There are no Load and Unload events for an IIS application. Instead, the BeginRequest or EndRequest events can perform some of the same functions as the Load and Unload event did — these events can be used to initialize values your application needs to run, and clean up state and other values at the end of a request. Begin and EndRequest are unique events for a webclass. A webclass may receive multiple requests throughout its life. These events allow the webclass to process each request as a unique entity.