使用 .NET 4.0 在 IE 中加载 .NET UserControls [英] Loading .NET UserControls in IE with .NET 4.0

查看:14
本文介绍了使用 .NET 4.0 在 IE 中加载 .NET UserControls的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个遗留应用程序,其中有一个 UserControl,它在 IE 中加载的网页中用作 activex.在 .NET 4.0 之前,有用于创建代码组等的安全策略和 MMC 控制台. .NET 4.0 似乎都没有了.

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.

我想知道是否有人可以给我一些关于如何更新我的 UserControl 项目以使其适用于 .NET 4.0 的线索.我一直在运行一些测试,但它们似乎都不起作用.事实上,我注意到如果我在编译之前将我的 UserControl 的 .NET 版本更新为 4.0,它甚至不会被添加到 GAC 下载区域.它被下载(使用 fiddler 对其进行测试),但它根本没有添加到 GAC 的下载区域.将.NET平台版本设置为3.5或以下,意味着dll添加到了GAC但它仍然无法从网页上使用(之前工作的旧JS代码一直说它不能在对象 Y 上找到成员 X).

I was wondering if someone could give me some clues on how to update my UserControl project so that it works against .NET 4.0. I've been running some tests and none of them seem to work. In fact, I've noticed that if I update the .NET version of my UserControl to 4.0 before compilint it, it won't even be added to the GAC download area. It gets downloaded (used fiddler to test it) but it simply isn't added to the GAC's download area. Setting the .NET platform version to 3.5 or below, means that the dll is added to the GAC but it's still unusable from the web page (the old JS code that worked before keeps saying that it cannot find member X on object Y).

那么,有人能指出我正确的方向吗?我需要在 .NET 4.0 中做什么才能在 Internet Explorer 中加载 .NET UserControl?

So, can anyone point me to the right direction? What do I need to do in .NET 4.0 to load a .NET UserControl in Internet Explorer?

谢谢.

推荐答案

现在默认阻止 IE 中的托管控件(从 v4 或 v4.5 开始).请参阅Web 应用程序"下的 MSDN 文章.

Hosting controls in IE is now blocked by default (as of v4 or v4.5). See MSDN article under 'Web Applications'.

幸运的是,使用这些 reg 键重新启用该功能非常容易:

Fortunately it is super-easy to re-enable the functionality with these reg keys:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NETFramework]
"EnableIEHosting"=dword:00000001

[HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoft.NETFramework]
"EnableIEHosting"=dword:00000001

x64 密钥是为我修复它的密钥,使用为 x32 编译的 .Net v3.5 SP1 控件在 Win7 (x64) 上运行 IE8 (x32).

The x64 key was the one that fixed it for me, running IE8 (x32) on Win7 (x64) using a .Net v3.5 SP1 control compiled for x32.

这篇关于使用 .NET 4.0 在 IE 中加载 .NET UserControls的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆