public DirectoryContext(ContextType ct, string name, string userName, string password) { PrincipalContext pc = new PrincipalContext(ct, name, userName, password); WindowsIdentity pident = WindowsIdentity.GetCurrent(); this.Process = new ProcessPrincipal(pc, pident); }
public DirectoryContext() { //populate process principal information WindowsIdentity pident = WindowsIdentity.GetCurrent(); PrincipalContext pc = null; try { pc = new PrincipalContext(ContextType.Domain); } catch { pc = new PrincipalContext(ContextType.Machine); } this.Process = new ProcessPrincipal(pc, pident); }