retrieving username, password registry keys set with aspnet_setreg

T

tcochunk

I have a VS .Net 2003 solution that contains 2 projects.

Project 1 is an ASP .Net application.

Project 2 is an EXE that is executed from another program (no UI).

Both projects interact with a SmarTeam database.

I used aspnet_setreg.exe to encrypt the username and password for the
asp process. I would like to retrieve these values from the registry
in project 2.

The values are coming back as byte(). This does not do me any good
because I need to pass a string username to SmarTeam.

How can I get these values as strings out of the registry?

Current Code Sample:

Dim HKLMSoftware As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software")

Dim SmLoginName As String
Dim SmLoginPassword As String
Dim HKLMSoftwareAspNetProcess As Microsoft.Win32.RegistryKey
Dim HKLMSoftwareAspNetSetReg As Microsoft.Win32.RegistryKey

HKLMSoftwareAspNetProcess = HKLMSoftware.OpenSubKey("ASPNetProcess")
HKLMSoftwareAspNetSetReg =
HKLMSoftwareAspNetProcess.OpenSubKey("ASPNET_SETREG")

Dim o As Object
o = HKLMSoftwareAspNetSetReg.GetValue("userName")
'o gets returned as a byte()

SmLoginName = CStr(HKLMSoftwareAspNetSetReg.GetValue("userName"))
SmLoginPassword = CStr(HKLMSoftwareAspNetSetReg.GetValue("password"))

....
 
H

Herfried K. Wagner [MVP]

tcochunk said:
o = HKLMSoftwareAspNetSetReg.GetValue("userName")
'o gets returned as a byte()

SmLoginName = CStr(HKLMSoftwareAspNetSetReg.GetValue("userName"))
SmLoginPassword = CStr(HKLMSoftwareAspNetSetReg.GetValue("password"))

Have a look at the 'System.Text.Encoding.*.GetString' methods.
 

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

Top