Directory Services in Windows Server 2008

3

We have some older code that we'll be upgrading in the future, but for now we'd like to figure out why this code is not valid for all of our domains in 2008.

Our older code:

entry = new DirectoryEntry("WinNT://" + domain + "/" + username);

The newer code:

UserPrincipal u= UserPrincipal.FindByIdentity(c, 
IdentityType.SamAccountName, username)

We have 2 domains, one trusts the other, though we don't control the domains. In Server 2003 the older code works without any problems for both domains. In Server 2008 it returns data successfully for our main domain, but throws an exception for the other.

The error is:

 System.Runtime.InteropServices.COMException (0x80070035): The network path was not found.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.PropertyValueCollection.PopulateList()
at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
at System.DirectoryServices.PropertyCollection.get_Item(String propertyName)

Why does WinNT fail for one domain in 2008, when it worked in 2003? Does Microsoft have any documentation on the WinNT type of DirectoryEntry? Is there a way to resolve this in Server 2008, other than upgrading the code?

c#
.net
directoryservices
asked on Stack Overflow Nov 8, 2011 by user696915 • edited Nov 9, 2011 by user696915

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0