title: Adding a User Control to a Webpage
body: <p>I have a compiled class library containing a user control and I'd like to add it to a webpage. I'm adding an object tag to the html page that looks like:</p>
  
  <pre><code> &lt;OBJECT id="Main" classid="http://localhost/HelloWorld/Hello.World.dll#Hello.World.UserControl"&gt;&lt;/OBJECT&gt;
  </code></pre>
  
  <p>However, the control isn't being displayed. The DLL makes it to my temp files and I get blank the object box on the webpage. I get an error message in my temporary internet files that looks like:</p>
  
  <blockquote>
    <p>?FusionBindError!name=Hello.World.dll Hello.World.UserControl</p>
  </blockquote>
  
  <p>I don't know how to debug this any further. I'm wondering if it's a namespacing issue?</p>
  
  <p>[Edit]</p>
  
  <p>The following error ended up in the log:</p>
  
  <pre><code>Creating security manager
  
  Microsoft.IE.Manager: Microsoft.IE.Manager: unique id lgth = 42
  Microsoft.IE.SecureFactory: Create SecureFactory() with security information
  Microsoft.IE.Manager: Created secure factory
  Microsoft.IE.SecureFactory: Creating instance of the object in the correct domain
  Microsoft.IE.SecureFactory: pUrl = http://localhost/HelloWorld/
  Microsoft.IE.SecureFactory: id = 86474707A31303E2234383E24333E2135330000000
  Microsoft.IE.SecureFactory: link = 
  Microsoft.IE.SecureFactory: licenses = 
  Microsoft.IE.SecureFactory: deployment manifest = 
  Microsoft.IE.SecureFactory: Security options = ZoneEvidence, SiteEvidence
  Microsoft.IE.Manager: Url = http://localhost/HelloWorld/
  Microsoft.IE.Manager: UrlGetPartW returned 0
  Microsoft.IE.Manager: UrlGetPartW returned 80070057
  Microsoft.IE.Manager: CodeBase = http://10.248.43.15
  Microsoft.IE.Manager: Application = HelloWorld
  Microsoft.IE.Manager: Found a codebase
  Microsoft.IE.Manager: UrlCanonicalize returned 0
  Microsoft.IE.SecureFactory: URL codeBase: http://localhost/
  Microsoft.IE.SecureFactory: URL application: HelloWorld
  Microsoft.IE.SecureFactory: Locating domain for http://localhost/
  Microsoft.IE.IDKey: Created key
  Microsoft.IE.Manager: The domain does not exist.
  Microsoft.IE.IDKey: Created key
  Microsoft.IE.Manager: The domain does not exist.
  Microsoft.IE.SecureFactory: Need to create domain
  Microsoft.IE.SecureFactory: Application base: http://localhost/
  Microsoft.IE.SecureFactory: Private Bin Path: bin
  Microsoft.IE.IDKey: Created key
  Microsoft.IE.SecureFactory: Trying to create instance of type http://localhost/HelloWorld/Hello.World.dll#Hello.World.Main
  Microsoft.IE.SecureFactory: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&gt; System.TypeInitializationException: The type initializer for 'ComponentFactory.Krypton.Toolkit.KryptonManager' threw an exception. ---&gt; System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
     at System.Windows.Forms.ToolStripManager.set_Renderer(ToolStripRenderer value)
     at ComponentFactory.Krypton.Toolkit.KryptonManager.b()
     at ComponentFactory.Krypton.Toolkit.KryptonManager..cctor()
  The action that failed was:
  Demand
  The type of the first permission that failed was:
  System.Security.Permissions.UIPermission
  The first permission that failed was:
  &lt;IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
  version="1"
  Window="AllWindows"/&gt;
  
  The demand was for:
  &lt;PermissionSet class="System.Security.PermissionSet"
  version="1"&gt;
  &lt;IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
  version="1"
  Window="AllWindows"/&gt;
  &lt;/PermissionSet&gt;
  
  The granted set of the failing assembly was:
  &lt;PermissionSet class="System.Security.PermissionSet"
  version="1"&gt;
  &lt;IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
  version="1"
  Access="Open"/&gt;
  &lt;IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
  version="1"
  Allowed="ApplicationIsolationByUser"
  UserQuota="512000"/&gt;
  &lt;IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
  version="1"
  Flags="Execution"/&gt;
  &lt;IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
  version="1"
  Window="SafeTopLevelWindows"
  Clipboard="OwnClipboard"/&gt;
  &lt;IPermission class="System.Security.Permissions.SiteIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
  version="1"
  Site="localhost"/&gt;
  &lt;IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
  version="1"
  Url="http://localhost/HelloWorld/Hello.World.dll"/&gt;
  &lt;IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
  version="1"
  Zone="Internet"/&gt;
  &lt;IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
  version="1"
  Level="SafePrinting"/&gt;
  &lt;IPermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
  version="1"&gt;
  &lt;ConnectAccess&gt;
  &lt;URI uri="(http|https)://localhost/*"/&gt;
  &lt;/ConnectAccess&gt;
  &lt;/IPermission&gt;
  &lt;/PermissionSet&gt;
  
  The assembly or AppDomain that failed was:
  Hello.World, Version=1.0.3460.18220, Culture=neutral, PublicKeyToken=null
  The method that caused the failure was:
  Void InitializeComponent()
  The Zone of the assembly that failed was:
  Internet
  The Url of the assembly that failed was:
  http://localhost/HelloWorld/Hello.World.dll
     --- End of inner exception stack trace ---
     at ComponentFactory.Krypton.Toolkit.KryptonManager.get_CurrentGlobalPalette()
     at ComponentFactory.Krypton.Toolkit.VisualPanel..ctor()
     at ComponentFactory.Krypton.Toolkit.KryptonPanel..ctor()
     at Hello.World.BottomPanel.InitializeComponent()
     at Hello.World.BottomPanel..ctor()
     at Hello.World.Main.InitializeComponent()
     at Hello.World.Main..ctor()
     --- End of inner exception stack trace ---
     at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandle&amp; ctor, Boolean&amp; bNeedSecurityCheck)
     at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
     at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
     at System.Activator.CreateInstance(Type type, Boolean nonPublic)
     at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
     at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
     at System.Activator.CreateComInstanceFrom(String assemblyName, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
     at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
     at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
     at Microsoft.IE.SecureFactory.CreateInstanceWithSecurity2(Int32 dwFlags, Int32 dwZone, String wszSite, String wszId, String wszConfig, String wszLicenses, String wszDeploymentManifest)
  Microsoft.IE.SecureFactory: LOG exception
  Microsoft.IE.SecureFactory: Creating log entry ?FusionBindError!name=Hello.World.dll Hello.World.Main
  Microsoft.IE.SecureFactory: Logging to file C:\Documents and Settings\----\Local Settings\Temporary Internet Files\Content.IE5\F84FN98R\CAMF3O8J.HTM
  </code></pre>
  
  <p>The IEHost Error log file (CAMF308J.HTM) contained:</p>
  
  <pre><code>*****   IEHOST Error Log (Monday, 22 June 2009 12:00)   *****
  
  
  
  URL:        http://localhost/HelloWorld/Hello.World.dll
  Zone:       3
  Assembly Name:  Hello.World.dll
  Type Name:  Hello.World.Main
  
  
  
  ----- Thrown Exception -----
  
  
  System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&gt; System.TypeInitializationException: The type initializer for 'ComponentFactory.Krypton.Toolkit.KryptonManager' threw an exception. ---&gt; System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
     at System.Windows.Forms.ToolStripManager.set_Renderer(ToolStripRenderer value)
     at ComponentFactory.Krypton.Toolkit.KryptonManager.b()
     at ComponentFactory.Krypton.Toolkit.KryptonManager..cctor()
  The action that failed was:
  Demand
  The type of the first permission that failed was:
  System.Security.Permissions.UIPermission
  The first permission that failed was:
  
  
  The demand was for:
  
  
  
  
  The granted set of the failing assembly was:
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  The assembly or AppDomain that failed was:
  Hello.World, Version=1.0.3460.18220, Culture=neutral, PublicKeyToken=null
  The method that caused the failure was:
  Void InitializeComponent()
  The Zone of the assembly that failed was:
  Internet
  The Url of the assembly that failed was:
  http://localhost/HelloWorld/Hello.World.dll
     --- End of inner exception stack trace ---
     at ComponentFactory.Krypton.Toolkit.KryptonManager.get_CurrentGlobalPalette()
     at ComponentFactory.Krypton.Toolkit.VisualPanel..ctor()
     at ComponentFactory.Krypton.Toolkit.KryptonPanel..ctor()
     at Hello.World.BottomPanel.InitializeComponent()
     at Hello.World.BottomPanel..ctor()
     at Hello.World.Main.InitializeComponent()
     at Hello.World.Main..ctor()
     --- End of inner exception stack trace ---
     at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandle&amp; ctor, Boolean&amp; bNeedSecurityCheck)
     at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
     at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
     at System.Activator.CreateInstance(Type type, Boolean nonPublic)
     at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
     at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
     at System.Activator.CreateComInstanceFrom(String assemblyName, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
     at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
     at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
     at Microsoft.IE.SecureFactory.CreateInstanceWithSecurity2(Int32 dwFlags, Int32 dwZone, String wszSite, String wszId, String wszConfig, String wszLicenses, String wszDeploymentManifest)
  </code></pre>