Accessing the ASP Built-in Objects

In IIS 3.0, components could access ASP built-in objects through the IScriptingContext interface. Components that needed to access the built-in objects did so through page-level event methods. While this method is still supported, an alternative now exists and is recommended as an improvement over page-level event methods.

You should now use the ObjectContext Object to access the built-in objects. ObjectContext makes IIS applications better suited for large-scale scenarios and provides support for transaction processing. It is highly recommended that you convert your existing ASP-based applications to this new approach if they are high-volume applications. This conversion is required if your applications support transaction processing.

The following code snippet demonstrates accessing the Response.Write method in Visual Basic®.

Public Function GetResponse()
  Dim vntCurrent As Variant
  Dim curres As ObjectContext
  Set curres = GetObjectContext ()
  vntCurrent = curres("Response").Write ("Hello World")
End Function
 

Details on accessing the built-in objects from script components, Visual Basic, Visual J++, and Visual C++ are provided in:

To view complete sample components that use ObjectContext to access the ASP built-in objects, see Developer Samples.

Note   If you implement your component as an executable file instead of as a dynamic link library, you will not be able to use ObjectContext to access the ASP built-in objects. In that case, you must use the Page-level Event Methods.