Bonjour,
je voudrais accéder aux attributs d'un usager dans l'active directory : le "mailNickname" et le "displayName", pour l'afficher dans un DropDownList, mais lorsque j'affiche la liste des attributs, j'obtiens System.byte[] dans la plupart des attributs.

homemdb - System.Byte[]
distinguishedname - CN=xxx xxx,OU=users,OU=industrie,DC=xxx,DC=com
st - Quebec
company - System.Byte[]
lastlogoff - System.Byte[]
mailnickname - System.Byte[]
dscorepropagationdata - System.Byte[]
msexchhomeservername - System.Byte[]
facsimiletelephonenumber - (xxx) xxx-xxxx
msexchalobjectversion - System.Byte[]
usncreated - System.Byte[]
objectguid - System.Byte[]
postalcode - xxx xxx
c - CA
whenchanged - System.Byte[]
memberof - System.Byte[]
msexchuseraccountcontrol - System.Byte[]
accountexpires - System.Byte[]
displayname - System.Byte[]
primarygroupid - System.Byte[]
streetaddress - System.Byte[]
badpwdcount - System.Byte[]
objectclass - top
objectcategory - System.Byte[]
instancetype - System.Byte[]
scriptpath - System.Byte[]
info - PC1486
samaccounttype - System.Byte[]
whencreated - System.Byte[]
lastlogon - System.Byte[]
l - xxx
useraccountcontrol - System.Byte[]
co - Canada
physicaldeliveryofficename - xxx, rue Principale
samaccountname - System.Byte[]
sn - xxx
givenname - xxx
mail - xxx
msexchmailboxsecuritydescriptor - System.Byte[]
adspath - LDAP://CN=xxx xxx,OU=users,OU=industrie,DC=xxx,DC=com
lockouttime - System.Byte[]
homemta - System.Byte[]
description - User
msexchmailboxguid - System.Byte[]
pwdlastset - System.Byte[]
logoncount - System.Byte[]
cn - xxx xxx
codepage - System.Byte[]
name - xxx xxx
usnchanged - System.Byte[]
legacyexchangedn - System.Byte[]
proxyaddresses - System.Byte[]
department - System.Byte[]
userprincipalname - System.Byte[]
badpasswordtime - System.Byte[]
objectsid - System.Byte[]
title - Secretaire
mdbusedefaults - System.Byte[]
telephonenumber - Ext: 758
showinaddressbook - System.Byte[]
countrycode - System.Byte[]
textencodedoraddress - c=CA;a= ;p=xxx;o=xxx;s=xxx;g=xxx;
lastlogontimestamp - System.Byte[]
msexchpoliciesincluded - System.Byte[]
ceci est dans la page sur le serveur de production

mais lorsque j'exécute la même page sur un serveur de développement, j'obtiens toutes les informations.

mon code est :
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
public void GetUser()
{
  DirectoryEntry objADAM = new DirectoryEntry("LDAP://dc=xxx,dc=com");
  DirectorySearcher objSearchADAM = new DirectorySearcher(objADAM);
  List<string> result = new List<string>();
 
  objSearchADAM.Filter = "(&(objectClass=user))";
  objSearchADAM.SearchScope = SearchScope.Subtree;
  SearchResultCollection objSearchResults = objSearchADAM.FindAll();
 
  SortedList list = new SortedList();
 
  ux_ListeUsager.Items.Clear();
  foreach (SearchResult res in objSearchResults)
  {
    ICollection coll = res.Properties.PropertyNames;
    string CodeUsager = "";
    string Usager = "";
    foreach (string item1 in coll)
    {
      ResultPropertyValueCollection colltest = res.Properties[item1];
      string itemtest = "";
      itemtest = Convert.ToString(colltest[0]);
      Response.Write(item1 + " - " + itemtest + "<br />");
      try
      {
        ResultPropertyValueCollection coll1 = res.Properties["mailNickname"];
        CodeUsager = coll1[0].ToString();
        ResultPropertyValueCollection coll2 = res.Properties["displayName"];
        Usager = coll2[0].ToString();
      }
      catch
      { }
    }
    Response.Write("<br />");
 
    if (!list.Contains(Usager))
      list.Add(CodeUsager, Usager);
  }
  foreach (DictionaryEntry Item in list)
  {
    ListItem newListItem = new ListItem();
    newListItem.Value = Item.Key.ToString();
    newListItem.Text = Item.Value.ToString();
    ux_ListeUsager.Items.Add(newListItem);
  }
}
Quelqu'un sait qu'est ce qui pourrait causer ce problème?

Merci d'avance