i want to create a control from a form where i have login textbox and password textbox, and login button. when i will enter the active directory account name and its password i want to go to another form. someone can help me with this please. in this code example i chose the account for login only. i want to chose it and type the password and go the destination form by exemple from form (login) to form (user interface).
private void radiobtnAD_CheckedChanged(object sender, EventArgs e)
{
if (radiobtnAD.Checked)
{
try
{
string filter = "(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))";
string[] propertiesToLoad = new string[1] { "name" };
using (DirectoryEntry root = new DirectoryEntry("LDAP://DOMAIN"))
using (DirectorySearcher searcher = new DirectorySearcher(root, filter, propertiesToLoad))
using (SearchResultCollection results = searcher.FindAll())
{
foreach (SearchResult result in results)
{
string name = (string)result.Properties["name"][0];
comboBox1.Items.Add(name);
}
}
}
catch
{
}
}
}