views:

18

answers:

1

I'm trying to load tokenGroups from Active Directory but it isn't working once deployed to a Windows Server (2003). I cannot figure out why, since it works fine locally...

Here is my error:

There is no such object on the server.

And here is my code (the sid variable is the current users SecurityIdentifier pulled from HttpContext):

DirectoryEntry userDE = new DirectoryEntry(string.Format("LDAP://<SID={0}>", sid.Value))
userDE.RefreshCache(new[] { "tokenGroups" });

var tokenGroups = userDE.Properties["tokenGroups"] as CollectionBase;
groups = tokenGroups.Cast<byte[]>()
    .Select(sid => new SecurityIdentifier(sid, 0)).ToArray();

Any ideas why I would get that error?

UPDATE: The error actually happens on the RefreshCache line

+1  A: 
marc_s
Had that, it didn't work...
Max Schmeling
Ahh, let me check that... I guess because of the way this AD stuff works it might not give me the error until that RefreshCache call... i'll check on it and hopefully that's my issue
Max Schmeling
DO you really require permissions to lookup a sid?
apoorv020
My actual problem is that WCF is seeing the current user as Network Service instead of my account... *sigh*
Max Schmeling
I'm on my 3rd day of trying to get WCF working with Windows Authentication through a web app... I'm starting to believe it just isn't supported.
Max Schmeling
@Max: guess you need to ask a new question :)
marc_s