How To Obtain ObjectContext with ObjectControl Inside Visual C++ COM DLL from ASP and MTS (239445)
The information in this article applies to:
- Microsoft Active Server Pages
- Microsoft Transaction Server 2.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Internet Information Server 4.0
This article was previously published under Q239445 SUMMARY
This article covers the implementation of the Microsoft Transaction Server (MTS) ObjectContext object through the ObjectControl object inside a Visual C++ component under MTS control for Active Server Pages (ASP).
This implementation is extremely useful if you would like to have direct access to the ASP intrinsic objects (for example, Application, Session, Response, Request, Server).
Visual C++ provides the Active Template Library (ATL) to assist you in developing COM components. Using the ATL COM AppWizard you can very quickly create the basic framework of your component. For example, the AppWizard generates all of the code that is necessary for exposing your component as a dual interface. In addition, ATL provides a wizard for adding objects to an ATL application. The ATL Object Wizard supports both methods of accessing the ASP built-in objects. If you want your component to use the page-level event methods (OnStartPage and OnEndPage) to access the built-in objects, you should pick ActiveX Server Component as the type from the wizard's opening screen. If you want your component to use the IObjectContext interface to access the built-in objects, you should choose Microsoft Transaction Server from the initial screen.
You should now use the ObjectContext object to access the built-in objects. ObjectContext makes Internet Information Server (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.
In the following sample you take advantage of an existing class that was distributed with one of the Visual C++ samples as part of the Windows NT 4.0 Option Pack IIS SDK Documentation. The IIS Software Developer Kit programmer documentation and samples portion of the Windows NT 4.0 Option Pack must first be installed before you can complete steps in this article.
These files are available in the ...\Iissamples\Sdk\Components\C++\Intermediate subdirectory of the Internet services directory.
REFERENCES
For additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
Q223406 How To Create an Empty MTS Package to Add Components for ASP
Q238274 How To Obtain ObjectContext with ObjectControl Inside VB COM DLL from ASP and MTS
Modification Type: | Minor | Last Reviewed: | 7/2/2004 |
---|
Keywords: | kbASPObj kbCodeSnippet kbhowto KB239445 kbAudDeveloper |
---|
|