Home > Cannot Write > Cannot Write To The Registry Key Setvalue

Cannot Write To The Registry Key Setvalue


Thanks Bob Nov 16 '05 #1 Post Reply Share this Question 7 Replies P: n/a Nicholas Paldino [.NET/C# MVP] Bob, Are you running the app locally or from a network share? RegistryKey.OpenSubKey Method (String, RegistryKeyPermissionCheck) .NET Framework (current version) Other Versions Visual Studio 2010 .NET Framework 4 Visual Studio 2008 .NET Framework 3.5 .NET Framework 3.0 .NET Framework 2.0  Retrieves the specified subkey I'm working on a Windows app that needs to write to the Registry HKLM. Registry.LocalMachine.OpenSubKey("SOFTWARE",true); Also, check the access permission for the target registry key and make sure your application have the certain premission. http://optimisersonpc.com/cannot-write/cannot-write-to-the-registry-key-c-net.html

Permalink Posted 11-Jan-10 9:42am Rick Shaub7.3K Rate this: Please Sign up or sign in to vote. RegistryKey rk = null; try { rk = Registry.CurrentUser.CreateSubKey("RegistryRightsExample", RegistryKeyPermissionCheck.Default, rs); Console.WriteLine("\r\nExample key created."); rk.SetValue("ValueName", "StringValue"); } catch (Exception ex) { Console.WriteLine("\r\nUnable to create the example key: {0}", ex); } if I ended up putting the registry parts into the deployment part of the machines, and thus i could run vbscripts in Windows post installation (just before it launches user login). This makes good sense anyway because different users often have different settings and preferences. http://stackoverflow.com/questions/7202752/cannot-write-to-the-registry-key

Cannot Write To The Registry Key Setvalue

Perhaps you have a 32 bit process on a 64 bit system and writes to HKLM\Software get redirected to HKLM\Software\Wow6432Node. You need to open the 64 bit key directly, or compile for AnyCPU. Here's the code. however I cannot create the key (despite I am part of local admin group, who have rights to do so).

  • Learning resources Microsoft Virtual Academy Channel 9 MSDN Magazine Community Forums Blogs Codeplex Support Self support Programs BizSpark (for startups) Microsoft Imagine (for students) United States (English) Newsletter Privacy & cookies
  • Just make this change to your code, RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\My_app" , true); Good luck!!
  • I keep getting a "System.UnauthorizedAccessException: Cannot write to the registry key." error when running the app.
  • This solved for me the need to do this.
  • stdarg and printf() in C Ballpark salary equivalent today of "healthcare benefits" in the US?
  • Does f:x mean the same thing as f(x)?
  • On 1941 Dec 7, could Japan have destroyed the Panama Canal instead of Pearl Harbor in a surprise attack?
  • Solution 4 Accept Solution Reject Solution run your application as administrator or use app.manifest in your project change this code in manifest file :
Back to Top