Home > Microsoft .Net Development Tips > ASP.NET Development > Make VB6 COM components work with ASP.NET
Win Development Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ASP.NET DEVELOPMENT

Make VB6 COM components work with ASP.NET


Jeff Prosise
04.21.2003
Rating: -4.67- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Avoid big performance hits -- or outright failure -- by marking your ASP.NET pages ASP-compatible.

If your ASP.NET application uses COM components written in Visual Basic 6.0, be sure to mark the pages that use them as ASP-compatible with an @ Page directive:

<%@ Page AspCompat="true" %>

Why? Some ASP.NET pages that use ASP COM components don't run without this directive. Others do, but they will incur a measurable (and sometimes dramatic) performance hit.

Here's the reason for the performance hit. By default, threads that process ASP.NET requests reside in a COM multithreaded apartment (MTA). COM components written in VB6 -- and COM components written in any language (including C++) that are registered as ThreadingModel="Apartment" or that have no registered ThreadingModel value -- run in COM single-threaded apartments (STAs). When threads running in an MTA call objects in STAs, those calls must be marshaled across apartment boundaries. They incur thread switches as they enter an STA. AspCo


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
ASP.NET Development
How to use jQuery to solve Javascript browser compatibility problems
How to write an out-of-browser Silverlight 3 application in 3 steps
Silverlight 3 beta SDK download lets developers try new RIA features
Visual Studio's IntelliSense for jQuery doesn't autocomplete correctly
Dundas Map for .NET kicks up geographic visualization
Return to CodePlex: Into the Sandcastle…
VBScript Tutorial
Use PHP with Visual Studio to create Web sites
Visual Studio Team System Add-ins: Conchango Scrum for Team System and Scrum Dashboard
Visual Studio 2008 and .NET Framework 3.5 SP1 introduces ADO .NET Entity Designer

ASP.NET development best practices
Introduction to ASP.NET's Model View Controller (MVC) Design Pattern
Silverlight, Ajax components require different approach to UI
LINQ Learning Guide: LINQ and Web applications
VB code download home page
VB code: File manipulation downloads
Localization practices for .NET 2.0: It's still about the architecture
Creating custom ASP.NET 2.0 profile providers
.NET development in the trenches
Microsoft developers balancing age-old issues, barrage of new technology
SearchVB.com's Podcast Page

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
136 browser colors with names  (SearchWinDevelopment.com)
ASP.NET  (SearchWinDevelopment.com)
browser  (SearchWinDevelopment.com)
Document Object Model  (SearchWinDevelopment.com)
domain name  (SearchWinDevelopment.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


mpat="true" forces ASP.NET threads into STAs, allowing those threads to call STA-based COM objects without marshaling or thread switches.

As a corollary, you should not use AspCompat="true" with COM components registered as ThreadingModel="Free" or ThreadingModel="Both". ASP COM components of this type are relatively rare, but they do exist. For more information and an in-depth analysis of the meaning and implications of AspCompat="true", read my "Ask the Pro" column in the March 2003 issue of asp.netPRO.

Jeff Prosise is author of several books, including "Programming Microsoft .NET" (Microsoft Press). He also is a co-founder of Wintellect, a software consulting and education firm that specializes in .NET.


This article is provided by asp.netPRO Magazine, an online information resource for the ASP.NET developer community, which helps professional software developers build, deploy and run the next generation of dynamic, distributed Web applications quickly and easily. Click here for subscription information.

Rate this Tip
To rate tips, you must be a member of SearchWinDevelopment.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Database Programming Solutions - .NET XML, Visual Studio LINQ, ORM .NET
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts