C# - How to set value of (Default) in the registry?

Hi!

How can I set the value of the (Default) key

Somehow registryKey.SetValue("(Default)", "value");

Doesnt work.

~Matt



Answer this question

C# - How to set value of (Default) in the registry?

  • biscuithead

    Im using Windows Vista but it works fine if I edit HKEY LOCAL MACHINE or CURRENT USER. It just wont work for CLASSES ROOT.

    ~Matt


  • Frank Miller

    what user account are you using to set the values remember, not all user account types will have full permission to modify the registry

  • Giritharan

    you don't need to use "(Default)", instead just leave it empty

    like this registryKey.SetValue("", "value");

    /Jocke


  • Thomas LEBRUN

    it works in xp. how can i fix this in vista

    Matt

  • William Bartholomew

    RegistryKey defaultbrowser1 = Registry.ClassesRoot.OpenSubKey("http\\shell\\open\\command", true);

    defaultbrowser1.SetValue("", "a");

    I get an exception:

    System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.

    Matt


  • C# - How to set value of (Default) in the registry?