This sample demonstrates how to create and use a component that uses the ASP built-in objects.
The myPowerMethod method, when invoked, calls the Component Services 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 Component Services method GetObjectContext to gain access to the ASP built-in objects, it is necessary to register the compiled component with COMPONENT SERVICES before the component can be run successfully. This can be accomplished from the MMC, using the Component Services Manager.
This project is available in the ...\components\vb\intermediate subdirectory of the IIS samples directory.