I need to access a registry key to save the password set by the user. For some reason, RegistryKey key = Registry.LocalMachine.OpenSubKey("Software", true);
throws a SecurityException error. I tried forcing proper permissions with this correction:
RegistryKey key = Registry.LocalMachine.OpenSubKey("Software", RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.WriteKey);
but the error still persists. Any suggestions? I would add that this code runs fine when the solution is deployed and run on a full admin user account. Standard user accounts trigger this exception.