Unable to create registry value using C# giving error Unhandeled error 'System.Security.SecurityException' occurred in mscorlib.dll
<p>I use the following code for creating a registry key Nodrives with its value 3FFFFFF at <code>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer</code></p>

<p>but its giving me security exception.</p>

<pre><code>RegistryKey rkey;
rkey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies", true); 
rkey.CreateSubKey("Explorer"); 
rkey.SetValue("NoDrives", "3FFFFFF");
rkey.Close();
</code></pre>

<p>Is the code correct or need any modifications??</p>
