Hi, I'm trying to connect to the active directory using asp. I'm having problems with logging in, what happens is the username accepted is not the user logon name but the displayname is accpeted heres the code:
Dim oRootDSE, oCon, oCmd, oRecordSet,oRecordset1
Dim sDomainADsPath, sUser, sPassword, sGroup, sProperties
Dim aDescription, aMember, iCount,aUser,oCmd1,oUsers,oUsersADsPath
Set oRootDSE = GetObject("LDAP://192.168.128.100/RootDSE")
sDomainADsPath = "LDAP://192.168.128.100/" & "cn=ichigo kurosaki;cn=users;" & oRootDSE.Get("defaultNamingContext") '' "cn=users;" &
Set oRootDSE = Nothing
Set oCon = Server.CreateObject("ADODB.Connection")
sUser = "ichigo kurosaki" ' "0034" my logon name is 0034 and the display and full name is ichigo kurosaki
sPassword = "abc123@" '
oCon.Provider = "ADsDSOObject"
oCon.Open "ADProvider", sUser, sPassword
Set oCmd = Server.CreateObject("ADODB.Command")
Set oCmd.ActiveConnection = oCon
sProperties = "samaccountname,name,ADsPath,cn"
sGroup = "*"
oCmd.CommandText = "<" & sDomainADsPath & ">;(&(objectCategory=user)(samaccountname=" & "0034"& "));" & sProperties '' & ";subtree"
oCmd.Properties("Page Size") = 100
when i use 0034 the page displays a permission denied error. is there a way to login with the logon name? and isnt the logon name supposed to be used for logging in and not the display name?
THANKS IN ADVANCE :cheesy: