Hello,
I am using this function code in vbs file and works, but in asp page does not work.
####################################
########################
In ASP page, the problem is here:
set objUser = objDSO.OpenDSObject (strPath, strUser, strPW, ADS_SECURE_AUTHENTICATION OR ADS_CHASE_REFERRALS_ALWAYS)
Could you help me please??
I checked strPath, strUser and, strPW and they have values.
Thanks
I am using this function code in vbs file and works, but in asp page does not work.
####################################
Code:
function AuthenticateUser(strUser, strPW)
Const ADS_SECURE_AUTHENTICATION = &h0001
Const ADS_CHASE_REFERRALS_ALWAYS = &h60
strUser=split(strUser,"\")
i=0
for each x in struser
if i=1 then
strUserName = x
end if
i=i+1
next
Set objNetwork = CreateObject("WScript.Network")
strDomain = objNetwork.UserDomain
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
Set objCommand.ActiveConnection = objConnection
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectclass=user)(objectcategory=person))"
strAttributes = "distinguishedName,sAMAccountName,displayName"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Cache Results") = False
Set objRecordset = objCommand.Execute
strPath = "LDAP://" & strDomain & "/" & strDNSDomain
Set objDSO = GetObject("LDAP:")
Do Until objRecordSet.EOF
if strusername = objRecordSet.Fields.item("sAMAccountName").Value then
strUser = objRecordSet.Fields.item("sAMAccountName").Value
set objUser = objDSO.OpenDSObject (strPath, strUser, strPW, ADS_SECURE_AUTHENTICATION OR ADS_CHASE_REFERRALS_ALWAYS)
If Err.Number <> 0 Then
response.write "NO COINCIDEN"
Else
response.write "COINCIDEN"
End If
Err.Clear
END IF
objRecordSet.MoveNext
Loop
End functionIn ASP page, the problem is here:
set objUser = objDSO.OpenDSObject (strPath, strUser, strPW, ADS_SECURE_AUTHENTICATION OR ADS_CHASE_REFERRALS_ALWAYS)
Could you help me please??
I checked strPath, strUser and, strPW and they have values.
Thanks