Welcome to MSDN Blogs Sign in | Join | Help

Diagnosing Control in browser issues

Controls hosted in the browser can often be difficult to debug.  If anything goes wrong with loading the dll or constructing the control instance, you will get nothing but the standard IE "something is wrong" image (the small icon in the top-left with colored shapes). 

Here's how I recommend diagnosing these issues:

1.  Turn on the debug log for IEHost

  • Add a DWORD to
    HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework called "DebugIEHost" and set the value to 1
  • Add a String to
    HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework called "IEHostLogFile" with the full path (I use c:\windows\temp\IEHostLog.log)

2.  Restart Internet Explorer (the log won't work if you don't) and navigate to your control.
3.  Look for the log file (it will be in the location you specified and appended with a number (usually 1).
 
It will look something like this for a successful control instantiation:
Creating security manager
Microsoft.IE.Manager: Microsoft.IE.Manager: unique id lgth = 46
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://ControlHostDomain/path/to/page/test.html
Microsoft.IE.SecureFactory: id = 86474707A3163707E65647D24756374777562610000000
Microsoft.IE.SecureFactory: link =
Microsoft.IE.SecureFactory: licenses =
Microsoft.IE.Manager: Url = http://ControlHostDomain/path/to/page/test.html
Microsoft.IE.Manager: UrlGetPartW returned 0
Microsoft.IE.Manager: UrlGetPartW returned 80070057
Microsoft.IE.Manager: CodeBase = http://ControlHostDomain
Microsoft.IE.Manager: Application = path/to/page
Microsoft.IE.Manager: Found a codebase
Microsoft.IE.Manager: UrlCanonicalize returned 0
Microsoft.IE.SecureFactory: URL codeBase: http://ControlHostDomain/
Microsoft.IE.SecureFactory: URL application: path/to/page
Microsoft.IE.SecureFactory: Locating domain for http://ControlHostDomain/
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://ControlHostDomain/
Microsoft.IE.SecureFactory: Private Bin Path: bin
Microsoft.IE.IDKey: Created key
Microsoft.IE.SecureFactory: Trying to create instance of type http://ControlHostDomain/path/to/page/MyControl.dll#MyControl
Microsoft.IE.SecureFactory: Created instance of type http://ControlHostDomain/path/to/page/MyControl.dll::MyControl
If you don't get a log file at all, it is probably because the control assembly could not be downloaded at all.  Check to ensure that the classid property is correct and that your web server is configured to serve .dll files

Published Friday, February 10, 2006 2:37 PM by AndrewDownum
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Strong names for controls in the browser

Friday, February 10, 2006 7:58 PM by Andrew's Blog
If you have a control hosted in the browser and you try to strong name it, you may find that it stops...

# Hosting Controls in Internet Explorer

Saturday, February 11, 2006 4:07 AM by Kirk Allen Evans' Blog
I recently tried to do a simple demo of hosting a control in IE to show how the CLR will behave when...

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker