query registry from aspx page

A

anthonyx26

Trying to query the registry here from my aspx page but keep getting the
following error. Any ideas?

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30188: Declaration expected.

Source Error:

Line 24: lpType As Long, lpData As String, lpcbData As Long) As Long
Line 25:
Line 26: RegistryKey key =
Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Setup",
false);
Line 27:
Line 28: Dim myregval = key.GetValue("BootDir").ToString();

Source File: C:\Inetpub\wwwroot\GMMM_uploadPR.aspx Line: 26
 
A

anthonyx26

Sorry for confusion. Using vb.net.

- anthony

Mark Rae said:
This seems to be a mixture of VB.NET and C#...

Line 24 looks like VB.NET, but it looks as if Dim is missing at the
beginning.

Line 26 looks like C# due to the instantiation syntax, the fact that
'false' is all lower-case, and the semi-colon at the end.

Line 28 looks like VB.NET, but it has a semi-colon at the end.

Please clarify what server-side language you are using...
 
G

Guest

Trying to query the registry here from my aspx page but keep getting the
following error.  Any ideas?

Server Error in '/' Application.
---------------------------------------------------------------------------­-----

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30188: Declaration expected.

Source Error:

Line 24:        lpType As Long, lpData As String, lpcbData As Long) As Long
Line 25:
Line 26: RegistryKey key =
Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVers­ion\\Setup",
false);
Line 27:
Line 28: Dim myregval = key.GetValue("BootDir").ToString();

Source File: C:\Inetpub\wwwroot\GMMM_uploadPR.aspx    Line: 26

Possibly a syntax error.
 
A

anthonyx26

I love the smell of fresh sarcasm in the morning :)

I ended up solving the problem by ripping out a bunch of junk code (I'm not
the one who had put the page together). This worked like a charm:

Dim MyPath =
Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\BlahCo\BlahProduct",
"Path", Nothing)

Just a little surprised no one else had suggested this simple one liner to
get the registry value. Plenty o' sarcasm though ;-)

Cheers!
- anthony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top