directoryservices - edirectory read custom property value Unknown error (0x8000500c) -
strange things happen...
i forced move new developer machine (windows server 2008 r2 2012). exact same code doesn't work on new machine.
public override membershipusercollection findusersbyemail(string emailtomatch, int pageindex, int pagesize, out int totalrecords) { membershipusercollection retvalue = new membershipusercollection(); string ldapconnectionstring = _configuration.getconnectionstring(); using (directoryentry de = new directoryentry(ldapconnectionstring, _configuration.searchaccount, _configuration.searchaccountpassword, authenticationtypes.serverbind)) { string filter = string.format("(&(objectclass=person)(customemail={0}))", emailtomatch); directorysearcher ds = new directorysearcher(de, filter, new[] { "cn", "customemail" }, searchscope.subtree); searchresultcollection collection = ds.findall(); totalrecords = collection.count; int pagescount = (totalrecords > pagesize) ? (int)math.ceiling((double)(totalrecords / pagesize)) : 1; if (pageindex > pagescount - 1) throw new indexoutofrangeexception("pageindex exceeds max pageindex"); (int = pageindex * pagesize; < totalrecords; i++) { directoryentry userdirectoryentry = collection[i].getdirectoryentry(); string username = userdirectoryentry.properties["cn"].value string; string provideruserkey = userdirectoryentry.path; string email = userdirectoryentry.properties["customemail"].value string; membershipuser mu = new membershipuser( providername: name, name: username, provideruserkey: provideruserkey, email: email, passwordquestion: null, comment: null, isapproved: true, islockedout: false, creationdate: datetime.minvalue, lastlogindate: datetime.minvalue, lastactivitydate: datetime.minvalue, lastpasswordchangeddate: datetime.minvalue, lastlockoutdate: datetime.minvalue); retvalue.add(mu); } } return retvalue; }
the code fails when trying read customemail property. system properties (such "cn") work.
the iis settings same although shouldn't matter binding process works. domain membership (i read various threads that) didn't change , not matter because it's edirectory , i'm using dedicated user bind anyway.
i can filter on property (see above) , view properties' names. network trace shows me properties and values transmitted on wire need there. , using ldap explorer jxplorer shows me complete directoryentry (including values).. c# code doesn't along it. i'm absolutely puzzled why works on 1 virtual machine , not on other one.
i'm intrigued fact data transmitted on wire (so directory has no permissions issues here) c# code unable extract values out of :(
i know old question, since busted brains same thing bit, figured worthwhile who's gotten far...
the problem lies in way directoryservices caches schema, if attempts load custom attribute (any attribute not familiar directoryservices via domain connected to) (hotfix windows 8/2012)
its documented in kb article http://support.microsoft.com/kb/2802148 includes hotfix should solve problem (if haven't solved already)
Comments
Post a Comment