Last post Sep 26, 2007 11:35 AM by johram
Sep 03, 2007 08:32 AM|timetotrace|LINK
my server : mys.haos.com.tr , it have a organization unit which name DMS , and DMS have some users. i want to acces "mail" address which given Name = "Mehmet" user. i write this code :
DirectoryEntry entry=new DirectoryEntry();
string path = "LDAP://MYS/OU=DMS,DC=Haos,DC=Com,DC=Tr";
DirectorySearcher search=new DirectorySearcher(entry);
DirectoryEntry userEntry = search.FindOne().GetDirectoryEntry();
whats the wrong ? ldap connection string is true ?
Sep 26, 2007 11:35 AM|johram|LINK
If you create a DirectoryEntry like this, without specifying explicit credentials, then he will try to connect with the credentials of the user running the process. Now, if you run this in VS2005 on your local machine it will probably work perfectly (given
that you are a member of the domain), but when you deploy it in the IIS, it will stop working. It is because the web (in IIS) is run by default with a local machine account that has no AD access. So either you must make sure your web runs with a domain account
(or your app pool), or you have to specify explicit credentials to your DirectoryEntry. One common way to do this is to create a Service account in the AD that only have read access to the data. Then this account can be used for tasks like this.