I am trying to pull some information from a vbscript varible into a text box on a web page to later then be submitted to a database via an asp script. The asp script and database are funtioning fine, but I cannot seem to pull the vbscript variable into the text box on the form. Below is my entire htm code:
<html>
<head>
<title>List Change</title>
</head>
<body bgcolor="white" text="black">
<script type="text/vbscript">
Const HKEY_CURRENT_USER = &H80000001
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Set wshshell = CreateObject("Wscript.shell")
oReg.EnumKey HKEY_CURRENT_USER, "Software\Microsoft\Protected Storage System Provider", arrSubKeys
sid = arrsubkeys(0)
CommonName = wshshell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Group Policy\State\" & sid & "\Distinguished-Name")
MyArray = Split(commonname,",",-1,1)
CommonNameValue = Replace(MyArray(0),"CN=","")
'VB Script variable
document.write(commonnamevalue)
</script>
<!-- Begin form code -->
<form name="form" method="post" action="List.asp">
'Need to pull variable in for value here
Name: <input type="text" name="FirstName" value = "<%=commonnamevalue%>">
<input type="submit" name="Submit" value="Submit">
</form>
<!-- End form code -->
</body>
</html>
I am basically trying to pull a user's name as it is stored in Active diretory and in order to do that I am pulling the current user's sid and then comparing it to all of the sid's in the registry and then splitting out the distinguised name key.
Any help is really appreciated and if something doesn't make sense please let me know. Also, if anyone has any better suggestions on how to submit a vbscript variable to a database via asp please let me know. This is my first time doing this, so there may be a more efficient way of doing it.
Thanks,
Chris
<html>
<head>
<title>List Change</title>
</head>
<body bgcolor="white" text="black">
<script type="text/vbscript">
Const HKEY_CURRENT_USER = &H80000001
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Set wshshell = CreateObject("Wscript.shell")
oReg.EnumKey HKEY_CURRENT_USER, "Software\Microsoft\Protected Storage System Provider", arrSubKeys
sid = arrsubkeys(0)
CommonName = wshshell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Group Policy\State\" & sid & "\Distinguished-Name")
MyArray = Split(commonname,",",-1,1)
CommonNameValue = Replace(MyArray(0),"CN=","")
'VB Script variable
document.write(commonnamevalue)
</script>
<!-- Begin form code -->
<form name="form" method="post" action="List.asp">
'Need to pull variable in for value here
Name: <input type="text" name="FirstName" value = "<%=commonnamevalue%>">
<input type="submit" name="Submit" value="Submit">
</form>
<!-- End form code -->
</body>
</html>
I am basically trying to pull a user's name as it is stored in Active diretory and in order to do that I am pulling the current user's sid and then comparing it to all of the sid's in the registry and then splitting out the distinguised name key.
Any help is really appreciated and if something doesn't make sense please let me know. Also, if anyone has any better suggestions on how to submit a vbscript variable to a database via asp please let me know. This is my first time doing this, so there may be a more efficient way of doing it.
Thanks,
Chris