Article ID: 317346 - Last Review: February 23, 2007 - Revision: 5.3 INFO: Native Versus COM-Callable .NET Controls in Internet Explorer
This article was previously published under Q317346 SUMMARY Instances of the .NET UserControl class -- .NET classes that are subclasses of the System.Windows.Forms.UserControl class -- can be hosted in Microsoft Internet Explorer
5.01-and-later in two different ways: directly through the .NET Runtime, or indirectly, as COM interop objects. Which approach you take depends on the
needs of your application. MORE INFORMATION Most developers prefer to host a .NET UserControl by using the overloaded syntax for the OBJECT tag, as follows This usage is very powerful, because .NET assemblies install by using the new zero-impact Fusion technology, which enables assembly installation without the need to write any secondary information to the user's registry. To update the control is as simple as downloading a new copy (which the Runtime takes care of automatically); removing it from the computer is as simple as removing the assembly from the Fusion download cache. However, because of security concerns, this usage has an important limitation: You can load only controls hosted on a Web server. Any attempt to load a UserControl in Internet Explorer from the file system or the global assembly cache will be unsuccessful. This can hinder you if your application runs locally from a CD-ROM or the user's hard disk, or if business requirements dictate that the controls that you want to use be placed in the global assembly cache. In such cases, you can compile your control to support COM interop, and host it within Internet Explorer as if it were a classic ActiveX control. This requires you to assign a globally unique identifier (GUID) to each COM-callable object by using the GuidGen.exe utility and the GuidAttribute metadata attribute defined in the .NET Framework. After that, you can use the Microsoft Windows Installer (MSI) to install your assembly on the user's target computer and register it as a COM object. REFERENCES For more information about how to prepare your assemblies for interop, visit the following Microsoft Developer Network (MSDN) Web sites:
Example COM Class (C#) Note Interop hosting of .NET UserControl members is supported in Internet Explorer but not in other
earlier version (legacy) COM containers.http://msdn.microsoft.com/en-us/library/aa287552(VS.71).aspx (http://msdn.microsoft.com/en-us/library/aa287552(VS.71).aspx) Walkthrough: Creating COM Objects with Visual Basic .NET http://msdn.microsoft.com/en-us/library/x66s8zcd(VS.71).aspx (http://msdn.microsoft.com/en-us/library/x66s8zcd(VS.71).aspx) For additional information, click the article number below to view the article in the Microsoft Knowledge Base: 311334
(http://support.microsoft.com/kb/311334/EN-US/
)
INFO: ActiveX Control Containers That Support .NET Controls
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
