Hi,
I have a problem in that I have some old asp/vbscript code (pre .NET) running on a Win2000 server that I need to update. The code authenticates a login (from a form) using our ldap server. We are moving ldap servers and the structure has changed. Previously all the users were in the same place so we could set the root directory but now they could be in a number of places down the tree.
To be able to authenticate the user I need to search ldap to find the users location in the tree before I can then go back and authenticate using the correct root directory. Has anyone managed to do this ? (I've spent hours on google with no luck).
This is how the code currently works (UserIdReq and PasswordReq are passed in from a form) :
Const cLDAPServer = "LDAP://ldap.mydomain:389/"
cNameString = "ou=staff,ou=accounts,dc=uea,dc=ac,dc=uk"
strNameString = cNameString
strADsPath = cLDAPServer + strNameString
strUserName = "cn=" + UserIdReq + "," + strNameString
strADsNamespace = left(strADsPath, instr(strADsPath, ":"))
set oADsNamespace = GetObject(strADsNamespace)
set oADsObject = oADsNamespace.OpenDSObject(strADsPath, strUserName, PasswordReq, 0)
' we've only managed to bind if err.number = 0
if not (Err.number = 0) then
ValidateLDAPUser = true
else
ValidateLDAPUser = False
end if
any pointers would be great as I'm really stuck.
Thanks,
Jay.
I have a problem in that I have some old asp/vbscript code (pre .NET) running on a Win2000 server that I need to update. The code authenticates a login (from a form) using our ldap server. We are moving ldap servers and the structure has changed. Previously all the users were in the same place so we could set the root directory but now they could be in a number of places down the tree.
To be able to authenticate the user I need to search ldap to find the users location in the tree before I can then go back and authenticate using the correct root directory. Has anyone managed to do this ? (I've spent hours on google with no luck).
This is how the code currently works (UserIdReq and PasswordReq are passed in from a form) :
Const cLDAPServer = "LDAP://ldap.mydomain:389/"
cNameString = "ou=staff,ou=accounts,dc=uea,dc=ac,dc=uk"
strNameString = cNameString
strADsPath = cLDAPServer + strNameString
strUserName = "cn=" + UserIdReq + "," + strNameString
strADsNamespace = left(strADsPath, instr(strADsPath, ":"))
set oADsNamespace = GetObject(strADsNamespace)
set oADsObject = oADsNamespace.OpenDSObject(strADsPath, strUserName, PasswordReq, 0)
' we've only managed to bind if err.number = 0
if not (Err.number = 0) then
ValidateLDAPUser = true
else
ValidateLDAPUser = False
end if
any pointers would be great as I'm really stuck.
Thanks,
Jay.