I'm reading some registries in ASP Classic to get some values I need and saving them as application level variables. In the global.asa file I have the code:
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
Application("test") = "testing..."
Dim WSHShell, regLink
Set WSHShell = CreateObject("WScript.Shell")
regLink = "HKEY_LOCAL_MACHINE\SOFTWARE\Odyssey\"
Application("test2") = WSHShell.RegRead(regLink & "value")
End Sub
</SCRIPT>
In my test.asp file, I simply output the "test" and "test2" variables. However, on running test.asp, I get the error message:
WshShell.RegRead error '80070002'
Invalid root in registry key
I have checked and double checked that the key indeed exists, and this code worked on our old server, so I think it is a configuration issue in IIS. I'll be damned if I can find it though. ASP Classic is installed and enabled, and I'm using IIS 7.5 on Windows Server 2008 R2 x64. Hopefully someone has an idea of what the problem is.
EDIT: I downloaded Process Monitor to look at the registry access. After some searching. I found that it is actually looking for the key in "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Odyssey\value". I gather this has to do with the server being 64x. I don't want to move the keys to that location, as they will likely never be found again, especially when the code points to a different directory.
Is there a way to stop this redirection or change the structure so this can work?
Thanks in advance for your help.
Doug