private void btnLogin_Click(object sender, EventArgs e) { string strUsername, strPassword, strDomain; strUsername = txtUsername.Text; strPassword = txtPassword.Text; strDomain = txtDomain.Text; if (strUsername == "") MessageBox.Show("Enter Username"); else if (strPassword == "") MessageBox.Show("Enter Password"); else if (strDomain == "") MessageBox.Show("Enter Domain"); else { strDomain = "LDAP://" + strDomain; using (DirectoryEntry deDirEntry = new DirectoryEntry(strDomain, strUsername, strPassword, AuthenticationTypes.Secure)) { // if user is verified then it will welcome then try { MessageBox.Show("Welcome to '" + deDirEntry.Name + "'"); // TODO: add your specific tasks here } catch (Exception exp) { MessageBox.Show("Sorry, unable to verify your information"+exp); } } } }
System.Runtime.InteropServices.COMException (0x8007203A): The server is not operational. at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_Name() at ldap.frmLdap.btnLogin_Click(Object sender, EventArgs e) in C:\Documents and Settings\divyar.DNISC\my documents\visual studio 2010\Projects\ldap\ldap\frmLdap.cs:line 41
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)