Microsoft KB Archive/814669

= PRB: Strong Named User Controls Do Not render in Internet Explorer =

Article ID: 814669

Article Last Modified on 4/29/2007

-

APPLIES TO


 * Microsoft .NET Framework Software Development Kit 1.0 Service Pack 2
 * Microsoft .NET Framework Software Development Kit 1.0 Service Pack 2
 * Microsoft Internet Explorer 6.0 Service Pack 1

-



SYMPTOMS
When you host a strong named .NET UserControl class in Microsoft Internet Explorer, the control does not render even if you create a machine-level code group for that strong name and then grant the code group Full trust in the Microsoft .NET Framework Configuration Tool (Mscorcfg.msc).



CAUSE
The Microsoft .NET Framework requires that you explicitly enable strong-named assemblies that partially-trusted callers such as Internet Explorer use. You must now declare the strong-named assemblies that are designed for use by partially-trusted code. Without this explicit declaration, the caller must have Full trust permissions to use the code.



RESOLUTION
Assemblies that are intended to be called by partially trusted code must declare the custom attribute, System.Security.AllowPartiallyTrustedCallersAttribute class. To add this attribute to the Assemblyinfo.vb or Assemblyinfo.cs, add the following lines of code:

Microsoft C# .NET
using System.Security; [assembly:AllowPartiallyTrustedCallers]

Microsoft Visual Basic .NET
Imports System.Security





STATUS
This behavior is by design.



Steps to Reproduce the Problem
 Create a .NET Windows Form control to host in Internet Explorer. For information about how to host secure, lightweight client-side controls in Microsoft Internet Explorer, visit the following Microsoft Developer Network Web site:  Use the Strong Name tool (Sn.exe) to sign your assembly with a strong name. For information about how to do this, click the following article number to view the article in the Microsoft Knowledge Base:

315682 Install an Assembly into the Global Assembly Cache in Visual Studio .NET

 Create a new code group. To do so, follow these steps:  Open the .NET Framework Configuration tool. In Control Panel, double-click Administrative Tools, and then double-click Microsoft .NET Framework Configuration. Expand the My Computer node. Expand the Runtime Security Policy node. Expand the Machine node, and then expand the Code Group node.</li> Right-click the All_Code node, and then select New.</li> Type a name for the new code group, and then click Next.</li> Select Strong Name from the Condition Type list. Import your DLL, and then click Next.</li> Select FullTrust from the existing permission set, and then click Next.</li> Click Finish.</li></ol> </li> Run the Web page that contains the UserControl class in Internet Explorer. Notice that the control does not render.</li></ol>

<div class="references_section">