SUMMARY
This article covers the implementation of the MTS
ObjectContext through the ObjectControl inside a Visual Basic component under
MTS control for ASP.
This is extremely useful if you would like to have
direct access to the ASP intrinsic objects; for example, Application, Session,
Response, Request, and Server.
In IIS 3.0, components access ASP
built-in objects through the IScriptingContext interface. Components that need
to access the built-in objects do 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.
Instead, 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.
Implement the ObjectControl interface when
you want to define context-specific initialization and cleanup procedures for
your MTS objects and specify whether or not the objects can be recycled.
The ObjectControl interface provides the following methods:
- Activate: Allows an object to perform context-specific initialization
whenever it's activated. This method is called by the MTS run-time environment
before any other methods are called on the object.
- CanBePooled: Allows an object to notify the MTS run-time environment of
whether it can be pooled for reuse. Return True if you want instances of this
component to be pooled, or False if not.
- Deactivate: Allows an object to perform whatever cleanup is necessary before
it's recycled or destroyed. This method is called by the MTS run-time
environment whenever an object is deactivated.