static void Main(string[] args) { User n = new User(); Console.WriteLine("Would you like to query the current domain? Y or N"); string a = Console.ReadLine(); if (a=="Y" || a=="y") { n.username= Environment.UserName; Console.WriteLine("What is your password?"); n.password = Console.ReadLine(); n.domain = Environment.UserDomainName.ToString().ToLower(); Console.WriteLine(n.domain); Console.WriteLine("Please enter username to query: "); n.name = Console.ReadLine(); try { n.ConnectionStatus(); Console.ReadKey(); } catch (Exception e) { Console.WriteLine(e.Message); } } else { runtime r = new runtime(); r.Start(); } }
public void Start() { User U = new User(); Console.WriteLine("Please enter preferred domain name: "); U.domain = Console.ReadLine(); Console.WriteLine(U.domain); Console.WriteLine("Please enter domain credentials"); Console.WriteLine("Username: "******"Password: "******"enter username to query: "); U.name = Console.ReadLine(); U.ConnectionStatus(); Console.ReadKey(); }
public DirectoryEntry createDirectoryEntry(string Lusername, string LpwdWord) { User L = new User(); DirectoryEntry ldapconnection = new DirectoryEntry(L.domain); ldapconnection.Path = "LDAP://CN=Users,DC=Blockhead,DC=com"; Lusername= L.username; LpwdWord= L.password; ldapconnection.Username = Lusername; ldapconnection.Password = LpwdWord; ldapconnection.AuthenticationType = AuthenticationTypes.Secure; return ldapconnection; }