Y
Yogi_Bear_79
I'm trying to set the value of a registry value that contains a rather
large hex value. Can someone look at my code and show me where I am
wrong? The below code appears to work, sort of. But I believe it is
adding my HEX number to the end of the exsisting value rather than
overwriting it:
private void SetCookieToPrompt()
{
using (RegistryKey Key = Registry.CurrentUser.OpenSubKey(sSubKey,
true))
{
Key.SetValue(@"Software\Microsoft\Windows\CurrentVersion\Internet
Settings\\Zones\3\{AEBA21FA-782A-4A90-978D-B72164C80120}",new
byte[]{0x1a,0x37,0x61,0x59,0x23,0x52,0x35,0x0c,0x7a,0x5f,0x20,0x17,0x2f,0x1e,0x1a,0x19,0x0e,0x2b,0x01,0x73,0x13,0x37,0x13,0x12,0x14,0x1a,0x15,0x3b,0x4e,0x2c,0x08,0x0d,0x20,0x1b,0x28,0x18,0x36,0x32});
Key.SetValue(@"Software\Microsoft\Windows\CurrentVersion\Internet
Settings\\Zones\3\{A8A88C49-5EB2-4990-A1A2-0876022C854F}",new
byte[]{0x1a,0x37,0x61,0x59,0x23,0x52,0x35,0x0c,0x7a,0x5f,0x20,0x17,0x2f,0x1e,0x1a,0x19,0x0e,0x2b,0x01,0x73,0x13,0x37,0x13,0x12,0x14,0x1a,0x15,0x3b,0x4e,0x2c,0x08,0x0d,0x20,0x1b,0x28,0x18,0x36,0x32});
}
}
To the inevitable question of why am doing this. I am writing a minor
application that adds sites to the restricted sites tab in IE. It also
adds a list of cookies to block, and the above values control weather
or not the user is prompted for cookie behavior or if it's
automatically controlled. I currently set the cookie behavior to
propmt manually. This code will do it for me automatically
large hex value. Can someone look at my code and show me where I am
wrong? The below code appears to work, sort of. But I believe it is
adding my HEX number to the end of the exsisting value rather than
overwriting it:
private void SetCookieToPrompt()
{
using (RegistryKey Key = Registry.CurrentUser.OpenSubKey(sSubKey,
true))
{
Key.SetValue(@"Software\Microsoft\Windows\CurrentVersion\Internet
Settings\\Zones\3\{AEBA21FA-782A-4A90-978D-B72164C80120}",new
byte[]{0x1a,0x37,0x61,0x59,0x23,0x52,0x35,0x0c,0x7a,0x5f,0x20,0x17,0x2f,0x1e,0x1a,0x19,0x0e,0x2b,0x01,0x73,0x13,0x37,0x13,0x12,0x14,0x1a,0x15,0x3b,0x4e,0x2c,0x08,0x0d,0x20,0x1b,0x28,0x18,0x36,0x32});
Key.SetValue(@"Software\Microsoft\Windows\CurrentVersion\Internet
Settings\\Zones\3\{A8A88C49-5EB2-4990-A1A2-0876022C854F}",new
byte[]{0x1a,0x37,0x61,0x59,0x23,0x52,0x35,0x0c,0x7a,0x5f,0x20,0x17,0x2f,0x1e,0x1a,0x19,0x0e,0x2b,0x01,0x73,0x13,0x37,0x13,0x12,0x14,0x1a,0x15,0x3b,0x4e,0x2c,0x08,0x0d,0x20,0x1b,0x28,0x18,0x36,0x32});
}
}
To the inevitable question of why am doing this. I am writing a minor
application that adds sites to the restricted sites tab in IE. It also
adds a list of cookies to block, and the above values control weather
or not the user is prompted for cookie behavior or if it's
automatically controlled. I currently set the cookie behavior to
propmt manually. This code will do it for me automatically