Getting Started
  Introduction
  What is ASP.NET?
  Language Support

ASP.NET Web Forms
  Introducing Web Forms
  Working with Server Controls
  Applying Styles to Controls
  Server Control Form Validation
  Web Forms User Controls
  Data Binding Server Controls
  Server-Side Data Access
  Data Access and Customization
  Working with Business Objects
  Authoring Custom Controls
  Web Forms Controls Reference
  Web Forms Syntax Reference

XML Web services
   created using ASP.NET

  Introducing XML Web services
  Writing a Simple XML Web service
  XML Web service Type Marshalling
  Using Data in XML Web services
  Using Objects and Intrinsics
  The XML Web service Behavior
  HTML Pattern Matching

ASP.NET Web Applications
  Application Overview
  Using the Global.asax File
  Managing Application State
  HttpHandlers and Factories

Cache Services
  Caching Overview
  Page Output Caching
  Page Fragment Caching
  Page Data Caching

Configuration
  Configuration Overview
  Configuration File Format
  Retrieving Configuration

Deployment
  Deploying Applications
  Using the Process Model
  Handling Errors

Security
  Security Overview
  Authentication & Authorization
  Windows-based Authentication
  Forms-based Authentication
  Authorizing Users and Roles
  User Account Impersonation
  Security and WebServices

Localization
  Internationalization Overview
  Setting Culture and Encoding
  Localizing ASP.NET Applications
  Working with Resource Files

Tracing
  Tracing Overview
  Trace Logging to Page Output
  Application-level Trace Logging

Debugging
  The SDK Debugger

Performance
  Performance Overview
  Performance Tuning Tips
  Measuring Performance

ASP to ASP.NET Migration
  Migration Overview
  Syntax and Semantics
  Language Compatibility
  COM Interoperability
  MTS Transactions

Sample Applications
  A Personalized Portal
  An E-Commerce Storefront
  A Class Browser Application
  IBuySpy.com

  Get URL for this page

COM Interoperability

The common language runtime enables .NET objects to interoperate seamlessly with traditional COM components. ASP.NET exposes the familiar Server.CreateObject(ProgId) API to developers for creating late-bound references to COM.

Dim myConn
myConn = Server.CreateObject("ADODB.Connection");

You can also use early-bound, traditional COM components by creating runtime callable wrappers (RCWs), which optimize the performance of calls between unmanaged and managed code. You can create an RCW using the Tlbimp.exe utility included in the .NET Framework SDK. For more information on Tlbimp.exe, see the Interoperability section of the Common Tasks QuickStart. The ASP.NET Performance section contains more information comparing late binding with early binding.

Like ASP, you can also create traditional COM components using the <object> tag with either a progid or a classid attribute. In addition to using the <object> tag in pages, you can also use it in the Global.asax file for the application. In this case, the object is added to the Page.Application.StaticObjects collection and exposed as a property with the same name as the object's id to all the pages in that application. Note that you cannot create single-threaded apartment (STA) objects statically in the Global.asax file because doing so generates a runtime error, as it does in ASP.

ASP.NET also continues to support the existing ASP intrinsic interfaces GetObjectContext and OnStartPage/OnEndPage. Supporting these interfaces means that you can use existing components (Commerce Server, Exchange, and so on) in ASP.NET pages. These interfaces are not enabled by default but are explicitly turned on using the following page directive:

<%@ Page ASPCompat="true" %>

This directive causes ASP.NET to create unmanaged ASP intrinsic objects and pass them to COM components used in the page. It also runs the page in an STA thread pool. See the following section for information.

Performance Considerations
In ASP.NET, the thread pool is a multithreaded apartment (MTA) by default, which can affect the performance of traditional apartment-threaded Visual Basic 5 and Visual Basic 6 components. The ASPCompat="true" attribute enables an STA thread pool to address performance with existing Visual Basic components on a per-page basis.

Calling between managed and unmanaged components also incurs a marshaling cost, which can impede the performance of your pages. Every scenario yields different performance characteristics, so it is important to test adequately before deciding whether interoperability is the right choice for your application. However, in nearly all scenarios, rewriting your COM components in managed code provides performance benefits. See the ASP.NET Performance section for more information and important tips.

Section Summary

  1. ASP.NET exposes the familiar Server.CreateObject API to developers for creating late-bound references to COM.
  2. You can also use early-bound, traditional COM components by creating runtime callable wrappers, which optimize the performance of calls between unmanaged and managed code.
  3. ASP.NET continues to support the existing ASP intrinsic interfaces GetObjectContext and OnStartPage/OnEndPage. These interfaces are explicitly enabled using the page directive <%@ Page ASPCompat="true" %>.
  4. The ASPCompat="true" attribute enables STA thread pools on a per-page basis to address performance with existing Visual Basic components.
  5. In nearly all scenarios, rewriting your COM components in managed code provides performance benefits.


Copyright 2001-2002 Microsoft Corporation. All rights reserved.