5

I know this has a simple solution, but I can't seem to make it work...

Using other Stack Overflow answers and Microsoft's Documentation, I know that PrincipalContext must be set up like this:

PrincipalContext pc = new PrincipalContext(ContextType.Domain, "YOURDOMAIN"); 

or also like this:

PrincipalContext domainContext = new PrincipalContext(ContextType.Domain,"YOURDOMAIN", null,ContextOptions.Negotiate | ContextOptions.SecureSocketLayer);  

My question is, what do I put for the "YOURDOMAIN" attribute if I am connecting to a local host?

Trying this ended in a PrincipalServerDownException:

PrincipalContext pc = new PrincipalContext(ContextType.Domain, "localhost:3600")
Community
  • 1
  • 1
AngeloS
  • 5,536
  • 7
  • 40
  • 58

1 Answers1

10

Is this what you're looking for? :

   PrincipalContext pc = new PrincipalContext(ContextType.Machine, null);
Chris Dickson
  • 11,964
  • 1
  • 39
  • 60
  • Thank you for your responce but that also resulted in a `PrincipalServerDownException` .. In Microsoft's docs I saw that they used something like `"foo.com"` for the `"YOURDOMAIN"` parameter .. so that's why I tried `"localhost:3600"` but it keeps bombing – AngeloS Mar 30 '11 at 15:31
  • @AngeloS: Are you sure you specified `ContextType.Machine`? `PrincipalServerDownException` is pretty bizarre when connecting to the local SAM store. – Chris Dickson Mar 30 '11 at 15:41