我正在尝试创建一个Windows应用程序,它也是IE的“可信站点”的URL。这部分有效。 解决方案 - http://www.nakov.com/blog/2009/05/15/c-code-for-changing-internet-explorer-security-settings-and-net-security-policy-to-run-windows-forms-based-activex-with-full-trust/
但我还需要更改相同的设置。我需要这个 : “跨域访问数据源”需要“启用” “下载未签名的ActiveX控件”需要“提示” “初始化和编写未标记为安全的ActiveX控件脚本”需要为“启用”
这就是我所拥有的,但它不会起作用
private void UpdateDataSource()
{
RegistryKey ChangeSettings = Registry.Users;
ChangeSettings = ChangeSettings.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\2", true);
// "Access data sources across domains" - "Enable"
ChangeSettings.SetValue("1406", "0", RegistryValueKind.DWord);
// "Download unsigned ActiveX controls" - "Prompt"
ChangeSettings.SetValue("1004", "1", RegistryValueKind.DWord);
// "Initialize and script ActiveX controls not marked as safe for scripting" - "Enable"
ChangeSettings.SetValue("1201", "0", RegistryValueKind.DWord);
ChangeSettings.Close();
}
答案 0 :(得分:3)
试试这个,它有效:
private void UpdateDataSource()
{
RegistryKey ChangeSettings = Registry.CurrentUser.OpenSubKey(@"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3", true);
// "Access data sources across domains" - "Enable"
ChangeSettings.SetValue("1406", "0", RegistryValueKind.DWord);
// "Download unsigned ActiveX controls" - "Prompt"
ChangeSettings.SetValue("1004", "1", RegistryValueKind.DWord);
// "Initialize and script ActiveX controls not marked as safe for scripting" - "Enable"
ChangeSettings.SetValue("1201", "0", RegistryValueKind.DWord);
ChangeSettings.Close();
}
答案 1 :(得分:1)
您可以访问此网站:http://networkdog.blogspot.com/2011/04/internet-explorer-9-configurations.html关于Internet Explorer 9注册表项。您可以找到所有的转发密钥。
答案 2 :(得分:0)
您可以尝试在IE中手动更改它,然后检查注册表中的更改内容并找到更改它的方法(通过直接更改注册表),或者找到更好的方法来更改该特定标记。
答案 3 :(得分:0)
太棒了,它有效..这是关键:
RegistryKey ChangeSettings = Registry.CurrentUser.OpenSubKey(@" Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings \ Zones \ 3",true);