[ASP] LDAP Authenticatie op Active Directory

Pagina: 1
Acties:

  • TweakersOnly
  • Registratie: September 2000
  • Laatst online: 01:13
Ik wil met behulp van ASP en een LDAP-koppeling de authenticatie gaan uitvoeren. Users moeten in een formulier de gebruikersnaam en wachtwoord invullen, waarna gecontroleerd worden of ze binnen Active Directory geregistreerd staan. Inmiddels heb ik de volgende code:

ASP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
dim Con, ocommand, gc, strField
 
' ADO Connection object
Set Con = CreateObject("ADODB.Connection")
Con.Provider = "ADsDSOObject"
Con.Open "Active Directory Provider"

' ADO Command object
set ocommand = CreateObject("ADODB.Command")
ocommand.ActiveConnection = Con
set gc = GetObject("LDAP:")
For Each child In gc
   Set entpr = child
Next

strField = Request.Form("Gebruikersnaam")
strBase = "<" & entpr.ADsPath & ">"
strObjects = "(objectCategory=person)"
strName = "(cn=" & strField & ")"
strFilter = "(&" & strObjects & strName & ")"
strAttributes = "cn,ADsPath"
strScope = "subtree"
    
ocommand.CommandText = strBase & ";" & strFilter & ";" & strAttributes & ";" & strScope
Set rs = ocommand.Execute
rs.close
rs.maxrecords = 900
Set rs = ocommand.Execute

IF (rs.Recordcount > 0) THEN
   Response.Write("De user is gevonden in Active Directory")
ELSE
   Response.Write("De user is niet gevonden in Active Directory")
END IF


Op dit moment wordt dus alleen gecontroleerd of de gebruikersnaam binnen Active Directory voorkomt. Ik weet echter niet hoe ik de combinatie gebruikersnaam en wachtwoord moet controleren. Wie heeft hier wel ervaring mee en kan mij helpen? :)

[ Voor 12% gewijzigd door TweakersOnly op 11-12-2002 15:56 ]


  • Gert
  • Registratie: Juni 1999
  • Laatst online: 05-12-2025
Gewoon in IIS iets met authenticatie rommelen? :o

Getting Started with ASP for ADSI is vast ook nuttig. :)