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

[180 byte] By [MateuszRajca] at [2007-12-24]
# 1

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

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

/Jocke

JockeOlsson at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...
# 2

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

MateuszRajca at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...
# 3
what user account are you using to set the values? remember, not all user account types will have full permission to modify the registry
ahmedilyas at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...
# 4

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

MateuszRajca at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...
# 5
it works in xp. how can i fix this in vista?

Matt

MateuszRajca at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...