Hosting Windows Forms Control in Internet Explorer

12:16 AM 0 Comments

Internet Explorer does not provide clear error messages when something goes wrong with loading a windows form user control in Internet Explorer. The page goes blank with a red cross or with a colorful icon. Here are some tips to troubleshoot and sort it out.

 

To host a user control in Internet Explorer, you create a html page with the following content object content

< object id="MyWinControl" width=100% height=1049px classid="http:MK.MyControl.dll#MK.MyControl.MainForm">

 

1. For .Net Controls embedded in html, .Net Framework code access security must be set up to allow the control to load and run. Otherwise, you will give a security permissions error and prevent the control from Loading. To trust the control, go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ and run the command on the client machine to set up the security of the Intranet Site

RUN CasPol.exe -q -m -ag All_Code -zone Intranet FullTrust

Clear IE Cache,  Close and reopen your browser

 

2. If Internet Explorer is still blocking the User Control ,create a DWORD enableIEhosting  and set it to 1 in your registry

For 64 bit Windows versions, the key should be

HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework

For 32 Bit Windows Versions,

HKLM\SOFTWARE\MICROSOFT\.NETFramework

 

3. Check If there is any denied access in your registry by using process monitor (procmon)

 

 

 

</ 0bject>

0 comments:

Thank you for your comments

Note: Only a member of this blog may post a comment.