In ASP.Net I'm trying to check for some users membership of a group.
The user is not nessicerily the user requesting the page, and I do not have
the users password.
So far I've created the following piece code:
DirectoryEntry group = new DirectoryEntry(FormatAdsiSyntax(strGroup) +
",group", "domain\\user", "password");
Object q = group.Invoke("IsMember", new object[]
{FormatAdsiSyntax(strUserID)});
if (q.Equals(false))
{
// ......
}
The function FormatAdsiSyntax simply returns a string like:
WinNT://domain/objectname
The user and password supplied is an account operator in the domain.
On my Windows XP workstation this piece of code works all right, even though
it's pretty slow.
But on a Windows 2000 Server an exception occours in the "Invoke" code line,
saying "The network path was not found".
Shouldn't this work on Win2K also ?
Can I somehow make this group membership check in another and faster way ?
(We'll not be upgrading to a 2003 Server AD until the beginning of next
year).
Thanks in advance,
Jan Nielsen