Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Langages serveur > ASP
ASP Forum sur la programmation ASP. Avant de poster : Cours ASP, FAQ ASP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 05/05/2008, 09h27   #1
Membre habitué
 
Développeur informatique
Inscription : octobre 2003
Messages : 448
Détails du profil
Informations personnelles :
Âge : 30

Informations professionnelles :
Activité : Développeur informatique

Informations forums :
Inscription : octobre 2003
Messages : 448
Points : 134
Points : 134
Par défaut Connexion ASP LDAP

J'ai une erreur lors de la tentative de connexion a mon annuaire LDAP sur le code suivant :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
  strLdap = "LDAP://" & AD_SERVER & "/" & AD_DC
  If (not strLdap= "") then
   'Bind to the ADSI object and authenticate Username and password
   'On error resume next
   set oADsNamespace = GetObject("LDAP:")
   Set oADsObject = oADsNamespace.OpenDSObject(strLdap, 
strConnection,adPassword, ADS_SECURE_AUTHENTICATION)
   If not (Err.number = 0) then
    Response.Write "Connexion impossible " & strLdap
    Response.write err.number & ":" & err.description
   Else
    Response.Write("<select name=""Login"" onChange=""document.forms[0].MDP.focus();"" style=""width:200; font-size: 8pt"">")
	      For Each obj in oADsObject
	       LOGIN_WINDOWS = obj.uid   
	       If LOGIN_WINDOWS <> "" Then
	        Response.Write("<option value="""& LOGIN_WINDOWS &""">"& LOGIN_WINDOWS &"</option>")
	       End If 
	      Next
	      Response.Write("<option value=""Synapse"" style=""color:#AA1111"">"& AffLgHtml("LoginUserSynapseTitre","") &"</option>")
	      Response.Write("</select>")
	     End If
	    End If
Mon erreur sur l'affichage est basé sur cette ligne " For Each obj in oADsObject" en indiquant un erreur "erreur '8007202c'" qui d'apres mes recherche me présise que "obj" n'est pas un objet.

Merci d'avance pour votre aide
PrinceMaster77 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 07/05/2008, 00h00   #2
Expert Confirmé Sénior

 
Avatar de Immobilis
 
Inscription : mars 2004
Messages : 5 862
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 5 862
Points : 5 982
Points : 5 982
Salut,

Tu peux essayer d'instancier "obj" au moment de sa déclaration
Code :
1
2
Dim obj
Set obj = nothing
Sinon, est-ce que "oADsObject" est bien une collection?

A+
Immobilis est actuellement connecté   Envoyer un message privé Réponse avec citation 00
Vieux 07/05/2008, 09h26   #3
Membre habitué
 
Développeur informatique
Inscription : octobre 2003
Messages : 448
Détails du profil
Informations personnelles :
Âge : 30

Informations professionnelles :
Activité : Développeur informatique

Informations forums :
Inscription : octobre 2003
Messages : 448
Points : 134
Points : 134
Par défaut J'ai toujours une erreur

J'ai toujours une erreur (erreur '8007202c') à cette ligne de code "For Each obj in oADsObject", meme en instanciant ma variable "obj" ??
PrinceMaster77 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 07/05/2008, 12h01   #4
Expert Confirmé Sénior

 
Avatar de Immobilis
 
Inscription : mars 2004
Messages : 5 862
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 5 862
Points : 5 982
Points : 5 982
Citation:
Envoyé par Immobilis Voir le message
Sinon, est-ce que "oADsObject" est bien une collection?
Immobilis est actuellement connecté   Envoyer un message privé Réponse avec citation 00
Vieux 07/05/2008, 15h01   #5
Membre habitué
 
Développeur informatique
Inscription : octobre 2003
Messages : 448
Détails du profil
Informations personnelles :
Âge : 30

Informations professionnelles :
Activité : Développeur informatique

Informations forums :
Inscription : octobre 2003
Messages : 448
Points : 134
Points : 134
Par défaut J'en doute

J'en doute car c'est le message qu'il me met que cela n'est pas une collection, pour en etre sur je te remet la totalité de mon code, et d'y moi ce que tu en pense et ou pourrais se trouver mon erreur.

Code :
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
35
36
37
38
 
 
	   If Application("pLDAP_AC") = "LDAP" Then
	    'Construction de la chaine de connexion
	    If adOu <> "" Then
	     strLdap = "LDAP://" & AD_SERVER & "/" & AD_OU & "," & AD_DC
	    Else
	     strLdap = "LDAP://" & AD_SERVER & "/" & AD_DC
	    End If 
 
    	    If adUser = "" Then
	     strConnection = ""
	    Else
	     strConnection = "cn=" & adUser & "," & AD_DC
	    End If  
 
	    If (not strLdap= "") then
	     'Bind to the ADSI object and authenticate Username and password
	     'On error resume next
	     set oADsNamespace = GetObject("LDAP:")
	     Set oADsObject = oADsNamespace.OpenDSObject(strLdap,strConnection,adPassword,ADS_SECURE_AUTHENTICATION)
	     If not (Err.number = 0) then
	      Response.Write "Connexion impossible " & strLdap
	      Response.write err.number & ":" & err.description
	     Else
	      Response.Write("<select name=""Login"" onChange=""document.forms[0].MDP.focus();"" style=""width:200; font-size: 8pt"">")
	      Dim obj
	      Set obj = nothing              
              For Each obj in oADsObject
	       LOGIN_WINDOWS = obj.uid   
	       If LOGIN_WINDOWS <> "" Then
	        Response.Write("<option value="""& LOGIN_WINDOWS &""">"& LOGIN_WINDOWS &"</option>")
	       End If
	      Next
	      Response.Write("<option value=""Synapse"" style=""color:#AA1111"">"& AffLgHtml("LoginUserSynapseTitre","") &"</option>")
	      Response.Write("</select>")
	     End If
	    End If
PrinceMaster77 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 00h47.


 
 
 
 
Partenaires

Hébergement Web