[Mono-list] Getting an octet string attribute value via DirectorServices (?)

Adam Tauno Williams adam@morrison-ind.com
Thu, 18 Nov 2004 16:34:18 -0500

I have an octet string attribute I'm trying to read from an LDAP server,
and according the the MSDN article 
I shoule be able to cast the value to a byte[].  But when I try to do so
in Mono I get a "Cannot cast from source type to destination type."
DirectoryEntry					dsAgent;
DirectorySearcher				searchAgent;
SearchResult					searchResult;
string						searchRoot;
byte[]						prefValue;

dsAgent = new DirectoryEntry(searchRoot);
searchAgent = new DirectorySearcher(dsAgent);
searchAgent.SearchScope = SearchScope.OneLevel;
searchAgent.Filter = "(&(objectclass=morrisonapplicationpreference)" +
                       "(morrisonapplicationname=" + appName + ")" +
                       "(morrisonpreferencename=" + prefName + "))";
searchResult = searchAgent.FindOne();
if (searchResult == null) {
  Console.WriteLine("No matching object found");
 } else {
     DirectoryEntry de = searchResult.GetDirectoryEntry();
     prefValue =
-----------<end snip>----------------------------------------------
SuSe Pro 9.2