I'm attempting to write a key to Registry. It works on Windows XP, but fails on Windows 7 / Vista.
The code below throws a Security Exception with description "Requested registry access is not allowed."
RegistryKey regKey =
Registry.LocalMachine.OpenSubKey("SOFTWARE\\App_Name\\" + subKey, true);
I realise that this has to do with the UAC settings, but I couldn't figure out an ideal workaround.
I don't want to fork out another process, and may be don't even want to request for any credentials. Just want it to work the same way as on Windows XP. I have modified the manifest file and removed requestedExecutionLevel node. This seems to do the trick.
Is there any other possible workaround, and are there any serious flaws with the "manifest" solution?