Access Denied when trying to create a key in registry

140 views Asked by At

Im trying to create a key and writing a dword value to it. My code results in access denied. My windows user has permission as i can manually add/edit the key.

RegistryKey Key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\ExistingKey\NewKey"); 
Key.SetValue("CurrentSlipNumber", CurrentSlipNumber, RegistryValueKind.DWord);

All the solutions i see involve modifying UAC or running my program as administrator. These are not available options.

How can i allow this to modify the registry with only code changes?

0

There are 0 answers