Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading .NET UserControls in IE with .NET 4.5

There is a similar question: Loading .NET UserControls in IE with .NET 4.0 This question is essentially the same, but for .NET 4.5

That question starts with: I've got a legacy app where there's a UserControl which is used as an activex in a web page loaded in IE. Before .NET 4.0, there were security policies and a MMC console for creating code groups, etc. It seems like that is all gone with .NET 4.0.

After installing .NET 4.5 it seems the workaround is no longer working, and that IE is unable to load any usercontrol. My fear is that this feature is removed altogether. In that case we have some serious rewriting to do before our users can install .NET 4.5

Some notes:

  • Everything was working perfectly fine with the .NET 4.5 RC. 8-(
  • Fuslogvw (Assembly Binding Log Viewer) Behaves as expected before upgrade, but after upgrade it is not logging anything. (And usercontrol is not being loaded.)
  • In production the controll will have to run with full trust, but all my testing has been done with a simple control that does not require this
  • Anybody who has sugestions or information regarding this feature?

    thanks

    like image 732
    Steinar Herland Avatar asked Aug 24 '12 12:08

    Steinar Herland


    1 Answers

    This is documented in the .NET 4.5 Application Compatibility Page on MSDN: http://msdn.microsoft.com/en-us/library/hh367887.aspx . Hosting managed controls inside IE is no longer supported out of the box (see half-way down under "Web Applications"):

    Feature: Managed browser hosting controls from the .NET Framework 1.1 and 2.0

    Change: Hosting these controls is blocked in Internet Explorer.

    Impact: Internet Explorer will fail to launch an application that uses managed browser hosting controls. The previous behavior can be restored by setting the EnableLegacyIEHosting value of the registry subkey HKLM/SOFTWARE/MICROSOFT/.NETFramework to 1.

    Unfortunately, the information on the registry key appears to be incomplete and wrong:

    • The setting is actually called "EnableIEHosting".

    • It must be located either in the HKCU Hive: HKCU\SOFTWARE\Microsoft\.NETFramework

    • or the HKLM hive, but under different paths, depending on the 32/64bit type of Windows:
      • 32-bit System: HKLM\SOFTWARE\MICROSOFT\.NETFramework
      • 64-bit System: HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework

    This was tested on both Windows Server 2008R2 and Windows 8.

    like image 134
    Michael Avatar answered Oct 13 '22 04:10

    Michael