active directory - C# Error reading domains in different domain -


i have code works fine when logged onto domain:

directorycontext context = new directorycontext(directorycontexttype.directoryserver, serverip, username, password);              var forest1 = forest.getforest(context);  using (var forest = forest.getforest(context)) {     foreach (domain domain in forest.domains)     {         directoryentry dedomain = domain.getdirectoryentry();         messagebox.show(string.format("{0} {1} {2}", domain.name, dedomain.path, dedomain.guid));     } } 

and works fine when accessing domain not logged onto ie. connection goes through ok , forest.domains populated.

the problem have whenever try access property of domain object (eg. domain.domainmode) 'unknown error (0x80005000)' - ideas?


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -