I'm trying to run a modified version of the example in this Microsoft
article:
http://msdn.microsoft.com/library/de...sekeytopic.asp
The only changes I've made to the code is that instead of using
"HKEY_CURRENT_USER\Environment" as my registry path I'm using
"HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Wi ndows" and setting
OpenRemoteBaseKey to open RegistryHive.LocalMachine instead of the
CurrentUser.
The problem is that I keep getting a SecurityException. I've tried inserting
the code below inside the try block but with no apparent effect
// ****************************
SecurityPermission sp =
new SecurityPermission(SecurityPermissionFlag.Unmanage dCode);
sp.Demand();
// ****************************
Anybody got a clue what's wrong and what I can do to fix it?