Intermediate Visual Basic Component

This sample demonstrates how to create and use a component that uses the ASP built-in objects. The myPowerMethod method, when invoked, calls the MTS method GetObjectContext to get a reference to the calling context. That reference is then used to access the built-in Request and Response objects. Request.ServerVariables is invoked to determine what kind of client browser is accessing the component, and a message is sent back to the client browser with the Response.Write method.

A read-only property is also implemented in this sample, as myPowerProperty. When this property is queried, GetObjectContext is again used to access the Request object, and determine the value of the SCRIPT_NAME variable.

In addition, this sample implements several methods, and a basic property. The myProperty property, along with methods to set and query the property, are included, as well as a simple method, myMethod, that can be used to convert the string contained in myProperty to uppercase.

Note Since this sample component uses the MTS method GetObjectContext to gain access to the ASP built-in objects, it is necessary to register the compiled component with MTS before the component can be run successfully. This can be accomplished from the MMC, using the MTS snap-in.

This sample is provided for educational purposes only. It has not been tested in a production environment, and Microsoft® will not provide technical support for it.

This project is available in the ...\iissamples\sdk\components\vb\intermediate subdirectory of the Internet services directory.


© 1997 by Microsoft Corporation. All rights reserved.