Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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).

↑ Back to the top


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.

↑ Back to the top


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 
<Assembly: AllowPartiallyTrustedCallers>

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

Steps to Reproduce the Problem


  1. 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: http://msdn.microsoft.com/en-us/magazine/cc301932.aspx
  2. 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
  3. Create a new code group. To do so, follow these steps:
    1. Open the .NET Framework Configuration tool. In Control Panel, double-click Administrative Tools, and then double-click Microsoft .NET Framework Configuration.
    2. Expand the My Computer node. Expand the Runtime Security Policy node. Expand the Machine node, and then expand the Code Group node.
    3. Right-click the All_Code node, and then select New.
    4. Type a name for the new code group, and then click Next.
    5. Select Strong Name from the Condition Type list. Import your DLL, and then click Next.
    6. Select FullTrust from the existing permission set, and then click Next.
    7. Click Finish.
  4. Run the Web page that contains the UserControl class in Internet Explorer. Notice that the control does not render.

↑ Back to the top


References

For more information about security changes for the Microsoft .NET Framework, visit the following Microsoft Web site:

↑ Back to the top


Keywords: KB814669, kbprb

↑ Back to the top

Article Info
Article ID : 814669
Revision : 6
Created on : 4/29/2007
Published on : 4/29/2007
Exists online : False
Views : 628