plop,

je cherche desespérement un bout de code permettant de tester d'authentifier un user en asp.net via openldap.

J'ai trouvé un bout de code qui maleureusement ne marche pas :/


Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 Dim dso
        Dim obj
 
        Dim adUsername As String
        Dim adPassword As String
        Dim adChemin As String
 
        Response.Write("debut")
 
        adUsername = "cn=Manager" '& ",dc=my-domain,dc=com"
        adPassword = "secret"
        adChemin = "ldap://localhost/cn=Manager,dc=my-domain,dc=com"
 
 
        On Error Resume Next
        dso = GetObject("LDAP:")
        If (Err.Number <> 0) Then
            Response.Write("GetObject " & Err.Description)
            Exit Sub
        End If
 
 
 
        On Error Resume Next
        obj = dso.OpenDSObject(adChemin, adUsername, adPassword, 0)
        If (Err.Number <> 0) Then
            Response.Write("OpenObject " & Err.Description)
            Exit Sub
        End If
 
        obj = Nothing
        dso = Nothing
        Response.Write("fin")
j'ai trituré ce code dans tous les sens et impossible de le faire marcher.
Quelqu'un aurait il une idée?

PS : pas bien compris dans les rules le tag a utiliser pour l'asp.net