Setting the Start Event

Before you can respond to user requests, you must, in most cases, write code that tells the webclass what to do when the application is first started. You can do this using the Start event.

The Start event occurs when the user first accesses your application by navigating to the .asp file that forms the base URL for your application. For example, if you have a webclass called Project1_OrderEntry.asp on a Web server called www.mycatalog.com, the base URL to fire the Start event for your application would be:

http://www.mycatalog.com/Project1_OrderEntry.asp

In most cases, you should write code for the Start event in order for Visual Basic to successfully run your webclass. You use the Start event to navigate to the first webitem in your application. The following code shows how you might do this:

Private Sub Webclass_Start()
   Set NextItem = Webitem1
End Sub

This code uses the NextItem property to navigate to the first webitem in the webclass, named Webitem1.

There are situations in which the Start event does not fire when the application is first launched. If the user specifies a webitem in the base URL, the webclass does not launch the Start event — instead, it launches the specified event for the webitem or the webitem's default event. For example, if the user knew they wanted to open a webitem called Form1 in the Project1_OrderEntry webclass, they could enter the following base URL to launch the application:

http://www.mycatalog.com/Project1_OrderEntry.asp?WCI=Form1

The notation WCI=Form1 tells the run-time DLL to open a webitem, called Form1 when it starts the application. In this case the Start event does not fire when the run-time DLL starts the application.

For More Information   See "The Webclass Life Cycle" for more information on the Start event in IIS applications. See "Transitioning Between WebItems" for more information on the NextItem property.