In a VB.NET application that runs as a service, I am getting a value of "Nothing" returned when I use Registry.CurrentUser.OpenSubKey(). The same code executes correctly when the application runs in desktop mode. I am not much on VB.NET and unfortunately, this is not my code.
Code:
Dim regURL As String = "Software\MyCompany\" + _
System.Reflection.Assembly.GetCallingAssembly.GetName.Name + _
"\Settings"
regKey = My.Computer.Registry.CurrentUser.OpenSubKey(regURL, True)
The regKey
is Nothing
when used by a service. Desktop returns a valid registry key object to which I feel verifies the URL. Any ideas I am using CurrentUser because this code does not work with LocalMachine when operating on Windows Server 2008.
Thanks in advance,
Craig