C# problem updating registry

  • Thread starter Thread starter Daniel Passwater via DotNetMonster.com
  • Start date Start date
D

Daniel Passwater via DotNetMonster.com

I'm trying to update the registry using C#. This seems like it should work:

int SecurityInt = 1;

// Open registry key.
RegistryKey rk = Registry.LocalMachine;
RegistryKey subKey = rk.OpenSubKey("SOFTWARE\\Microsoft\\Cryptography\\
IEDirtyFlags\\",true);

// Update key value.
rk.SetValue("dirtiest", Convert.ToString(SecurityInt));

Does anyone see what I'm doing wrong.

Thanks.
 
You migh not have sufficient privileges to write to that part of registry.
Check the GetLastError value
 
No exception. It runs through the function and the local variables are
updated, but there's no change in the registry. It reads it just fine. It
just won't update it.
 
Do you call Close on the registry key? (you've not shown that in your code).

Peter
 
Back
Top