views:

192

answers:

2

I'm trying to read values from the registry but somehow I seem to be getting the wrong registry. I can't read from any keys that I create and changing the values of keys that I am able to get seems to have no effect.

I'm using Registry.GetValue to get the values and it is returning either null for my keys or the original value for the keys that I changed.

I'm reading the values in an aspx page. The OS is Windows Server 2003 SP2 64bit. IIS is running in 32bit. I'm not sure what other information might be relevant here.

Any information on how this can happen and what I can do about it is appreciated.

A: 

Make sure you're not writing to HKEY_CURRENT_USER. Those are for settings localized to the logged in user. Your ASP.NET app isn't going to be able to access your registry settings.

I'm not sure exactly, but I'd suggest trying to place your keys in HKEY_LOCAL_MACHINE/Software. That's where the system wide (like your asp.net app) settings go.

Justin Niessner
+5  A: 

If IIS is running in 32-bit mode on a 64-bit server, it will be accessing the WOW64 registry. Try setting values under HKLM\Software\Wow6432Node instead, which will map to a 32-bit process's view of HKLM\Software

Michael
Thats new info for me. Thanks :)
Shoban
That was it. Thanks a lot. Crazy 32bit process on 64bit OS issues :)
Brian