INFO: Native Versus COM-Callable .NET Controls in Internet Explorer

IMPORTANT : Cet article est issu du système de traduction automatique mis au point par Microsoft ( Un certain nombre d’articles obtenus par traduction automatique sont en effet mis à votre disposition en complément des articles traduits en langue française par des traducteurs professionnels. Cela vous permet d’avoir accès, dans votre propre langue, à l’ensemble des articles de la base de connaissances rédigés originellement en langue anglaise. Les articles traduits automatiquement ne sont pas toujours parfaits et peuvent comporter des erreurs de vocabulaire, de syntaxe ou de grammaire (probablement semblables aux erreurs que ferait une personne étrangère s’exprimant dans votre langue !). Néanmoins, mis à part ces imperfections, ces articles devraient suffire à vous orienter et à vous aider à résoudre votre problème. Microsoft s’efforce aussi continuellement de faire évoluer son système de traduction automatique.

La version anglaise de cet article est la suivante: 317346
Cet article a été archivé. Il est proposé « en l'état » et ne sera plus mis à jour.
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.
Plus d'informations
Most developers prefer to host a .NET UserControl by using the overloaded syntax for the OBJECT tag, as follows
<OBJECT id="Obj1" classid="Assembly.dll#Full.Namespace.ControlName">				
where "Assembly.dll" is a relative, virtual, or absolute path to the .NET assembly that contains your control, and "Full.Namespace.ControlName" is a fully-qualified namespace reference to the control that you want to host.

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.
For more information about how to prepare your assemblies for interop, visit the following Microsoft Developer Network (MSDN) Web sites: note Interop hosting of .NET UserControl members is supported in Internet Explorer but not in other earlier version (legacy) COM containers.

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
311334 INFO: ActiveX Control Containers That Support .NET Controls

Avertissement : Cet article a été traduit automatiquement.


ID d'article : 317346 - Dernière mise à jour : 02/24/2014 15:41:10 - Révision : 5.3

Microsoft .NET Framework 1.1, Microsoft .NET Framework 1.0, Microsoft Internet Explorer 5.01, Microsoft Internet Explorer 5.5, Microsoft Internet Explorer (Programming) 6.0

  • kbnosurvey kbarchive kbmt kbcominterop kbctrl kbinfo KB317346 KbMtfr