2

I have AD LDS installed on 2 different machines.One of them is Windows 8 the other one is win 2008.I installed AD LDS with the exactly same configuration. The code above works in Windows 8 but not on Windows 2008 R2 Server. What do i need to do enable anonymous search in Windows 2008 ?

DirectoryEntry userEntry = new DirectoryEntry(DIRECTORY_SERVER); // intentionally without user name and password

DirectorySearcher ds = new DirectorySearcher(userEntry);
string accountName = userName.Split(new char[] { Convert.ToChar("\\") })[1];
ds.Filter = ("SAMAccountName=" + accountName);
SearchResult results = null;
try
   {
      results = ds.FindOne();
   }
catch (Exception)
   {
      return false;
   }
il_raffa
  • 5,090
  • 129
  • 31
  • 36

0 Answers0