Last post May 23, 2005 09:56 PM by dwyl
May 13, 2005 03:59 AM|dwyl|LINK
May 13, 2005 10:50 AM|dunnry|LINK
Check the .PropertiesToLoad on the DirectorySearcher. If you have only specified 'sn', that is all that will be there (and 'adsPath'). If you don't specify anything for this collection, it will return all attributes you have permission to see.
May 17, 2005 03:59 AM|dwyl|LINK
I have tried both with / without (uName, pwd, AuthenticationTypes.Secure), it didn't seem to make any difference; ie only sn was returned. Any idea?
Here is my code
//formating Dir path
String uName = "cn=Administrator, cn=Users, dc=mydomain, dc=com";
String pwd = "adminpwd";
String Server = "server01";
String strPath = "LDAP://" + Server +"/";
String searchPath = "LDAP://ou=myOU, dc=mydomain, dc=com";
//Bind to the server and authenticate
DirectoryEntry entry = new DirectoryEntry(searchPath, uName, pwd, AuthenticationTypes.Secure);
//DirectoryEntry entry = new DirectoryEntry(searchPath);
Object native = entry.NativeObject;
//do a DirectorySearch
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = "(objectClass=user)";
SearchResultCollection resEntAll = mySearcher.FindAll();
May 23, 2005 09:08 PM|dunnry|LINK
There are only 2 reasons I can think of why some attributes show and others don't:
You can check both by using an LDAP browser like ldp.exe or
If you use the same credentials as the ASP.NET app and cannot see the attributes using either tool, then you should check using Admin credentials. If you still can't see it, it doesn't exist. If you can see it, it is a permission issue.
May 23, 2005 09:56 PM|dwyl|LINK
Thanks. I just got it fixed. The problem was not with the credentials, I was authenticated all along with the login.aspx which had the cookies set. The problem was with the second foreach loop, and the switch - case statement, these just didn't work,
not sure why though. I end up have to use the if-else (one for each attribute), even the nested if-else would not work. If my finding was right, this could be something for the .NET group to improve.
Thanks again, anyway.