retrieving username, password registry keys set with aspnet_setreg

  • Thread starter Thread starter tcochunk
  • Start date Start date
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"))

....
 
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.
 
Back
Top