Share via


Accessing ASP Built-In Objects from Components

Use the COM+ ObjectContext object to access the ASP built-in objects from an application. This object implements the COM+ IObjectContext interface. The COM+ ObjectContext object makes IIS Web components better suited for large-scale scenarios and provides support for transaction processing. For high-volume applications, tt is highly recommended that you convert any existing components that use ScriptingContext to use the COM+ ObjectContext object. This conversion is required if your applications support transaction processing.

note Note In older versions of IIS, components accessed the ASP built-in objects by creating an instance of the ScriptingContext object, which implemented the IScriptingContext C++ Interface interface. Components that needed to access the ASP built-in objects did so through Page-level Event Methods. This approach still works in order to be compatible with existing ASP applications, however, it is not recommended and not supported on recent versions of IIS. It is better to use the COM+ ObjectContext object with one exception: if you implement your component as an executable file instead of a dynamic link library, you cannot use the COM+ ObjectContext object to access the ASP built-in objects. You must use IScriptingContext C++ Interface and Page-level Event Methods.

The following code snippet demonstrates accessing the Response.Write method using the COM+ ObjectContext object in Visual Basic(VB).

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

For more code snippets and information about accessing the ASP built-in objects, see:

Related Topics