I am setting a registry setting and I can do so if the value is in [HKEY_CURRENT_USER] but if the value is in [HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\9.0\ethan] then I get the following error:
ex {"Cannot write to the registry key."} System.Exception {System.UnauthorizedAccessException}
does anyone know what might be wrong? See code below:
private string setRegKey(string machinename)
{
try
{
RegistryKey regKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.CurrentUser, machinename).OpenSubKey("Software").OpenSubKey("Adobe").OpenSubKey("Acrobat Reader").OpenSubKey("9.0").OpenSubKey("ethan");
regKey.SetValue("Test", 1);
regKey.Close();
return "Success";
}
catch (Exception ex)
{
return "Error: " + ex.ToString();
}
}