LuckyDice
LuckyDice

Reputation: 55

change IE settings Programmatically

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/

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

source http://www.hohmanns.de/

Upvotes: 3

Views: 5572

Answers (4)

Jayan
Jayan

Reputation: 1

Fantastic, it works.. This is the key:

RegistryKey ChangeSettings = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", true);

Upvotes: 0

Mahmut EFE
Mahmut EFE

Reputation: 5248

You can visit this web site : http://networkdog.blogspot.com/2011/04/internet-explorer-9-configurations.html About internet explorer 9 registry key. You can find all configration key.

Upvotes: 1

Rohit
Rohit

Reputation: 31

Try this, it works:

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

Upvotes: 3

Michel Keijzers
Michel Keijzers

Reputation: 15357

You could try to change it manually in IE, then check what is changed in the registry and find a way to change it (by changing the registry directly), or find a better way to change that particular tag.

Upvotes: 0

Related Questions