开发者

to change WinHttpSettings registry value

开发者 https://www.devze.com 2023-03-18 10:55 出处:网络
I am trying to change \'WinHttpSettings\'Registry value but it\'s giving error. I tried like below RegistryKey OurKey = Registry.LocalMachine;

I am trying to change 'WinHttpSettings' Registry value but it's giving error. I tried like below

       RegistryKey OurKey = Registry.LocalMachine;
        //MessageBox.Show(OurKey.ToString());
        RegistryKey local = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersi开发者_Python百科on\Internet Settings\Connections");
        string value = local.GetValue("WinHttpSettings").ToString();
        byte[] b ={ 1, 1, 1, 1 };
        if (value != null)
        {
            local.SetValue("WinHttpSettings",b);
            //MessageBox.Show(value.ToString());
        }

Any mistake i done in above code or any other solution

before in registry the value is like below:

to change WinHttpSettings registry value

after doing 'Steve B' told change:

 RegistryKey local = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections",true);

to change WinHttpSettings registry value

but i wanted is to change first image values as '0000'


Change this line :

RegistryKey local = Registry.LocalMachine.OpenSubKey(
    @"SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections",
    true
    );

Especially, notice the true as second argument. As explained in the documentation, its use is :

 writable Type: System.Boolean 
 Set to true if you need write access to the
 key.
0

精彩评论

暂无评论...
验证码 换一张
取 消