to change WinHttpSettings registry value
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:
after doing 'Steve B' told change:
RegistryKey local = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections",true);
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.
精彩评论