以编程方式更改 IE 设置 [英] change IE settings Programmatically

查看:60
本文介绍了以编程方式更改 IE 设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个 Windows 应用程序,该应用程序也添加了 IE 的受信任站点"的 URL.这部分有效.解决方案 - http://www.nakov.com/blog/2009/05/15/c-code-for-changed-internet-explorer-security-settings-and-net-security-policy-to-run-windows-forms-based-activex-with-full-trust/

I am trying to make a windows application that adds a URL too the "Trusted sites" of IE. this part works. solution - 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 控件"需要启用"

But i need to change same settings also. i need this : "Access data sources across domains" needs to be "Enable" "Download unsigned ActiveX controls" needs to be "Prompt" "Initialize and script ActiveX controls not marked as safe" needs to be "Enable"

这就是我所拥有的,但它不起作用

this is what i have, but it won't work

    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();
    }

来源 http://www.hohmanns.de/

推荐答案

试试这个,它有效:

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();    
}

这篇关于以编程方式更改 IE 设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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