I'm working on a Windows app that needs to write to the Registry HKLM. I
keep getting a "System.UnauthorizedAccessException: Cannot write to the
registry key." error when running the app. I'm logged in as an
Administrator and it's a Windows app. What permission does it need? Here's
the code.
private void ChangeReg() {
string regPath =
"SOFTWARE\\Microsoft\\.NETFramework\\AssemblyFolde rs";
RegistryKey thisKey = Registry.LocalMachine;
thisKey = thisKey.OpenSubKey(regPath);
thisKey = thisKey.CreateSubKey("MyTest"); //it fails here.
...........
}
I read about the System.Security.Permissions.RegistryPermission class but
can't figure out how it works with with the RegistryKey class. Could anyone
help?
Thanks
Bob