Link to home
Start Free TrialLog in
Avatar of Valimai
Valimai

asked on

Returns NULL ... RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\MyCompany");

hello,

I am having a problem reading the registry. The following line returns NULL.
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\MyCompany");

Windows XP 64 bit
IIS running 32bit .NET framework and IIS enabled to run 32 bit apps.

Key was created manually using regedit.

I am administrator on this machine.

Any ideas? thanks

BTW, this works
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE");
Avatar of aphillips
aphillips
Flag of Australia image

This is a real mystery. It's not a privilege problem as SecurityException would be thrown.

Do other sub-keys work?

  RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft");

Have you tried?

  RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE");
  RegistryKey key2 = key.OpenSubKey(@"MyCompany");
Avatar of Valimai
Valimai

ASKER

Yes, I tried the SOFTWARE key only and it returned a result. Any sub folder created cannot be read.

We have since decided that the machine has a problem and will re-install the OS.

If you do not mind, I will ask that this question be deleted.
ASKER CERTIFIED SOLUTION
Avatar of graye
graye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Valimai

ASKER

We have re-installed the machine to 32bit. Your explaination sounds plausable.