private void cmdValidateLDAP_Click(object sender, EventArgs e) { string errormsg = null; LDAPSettingsObject ldapSettingsObj = new LDAPSettingsObject(); // assign values to ldap object ldapSettingsObj.Group_string = txtGrpString.Text; ldapSettingsObj.IP_Address = txtLDAPIPAddress.Text; ldapSettingsObj.Login_Attribute = txtLoginAttribute.Text; ldapSettingsObj.Password = txtLDAPPassword.Text; if (txtPort.Text != "" && Convert.ToInt32(txtPort.Text) > 0) ldapSettingsObj.Port = Convert.ToInt32(txtPort.Text); ldapSettingsObj.Search_base = txtSearchBase.Text; ldapSettingsObj.serverType =LDAPSettingsObject.LDAPServerType.ACTIVE_DIRECTORY; ldapSettingsObj.Username = txtLDAPUserName.Text; ldapSettingsObj.SSL = cbLDAPSSL.Checked; // testing this w/out webservice LdapConnection ldc = null; LDAPStatusCode lsc = LDAPStatusCode.OpSuccess; bool _bSuccess = ConnectToActiveDirectory(ldapSettingsObj, ldapSettingsObj.Username, ldapSettingsObj.Password, ref ldc, ref lsc); // test this WITH webservice // bool _bSuccess = GetController.wsController.Security_ValidateLDAP( // ldapSettingsObj, ref errormsg); if (_bSuccess == true) { // success, display success msg MessageBox.Show("Connection to LDAP Server Successful", MessageBoxButtons.OK); } else if (_bSuccess == false && errormsg != null) { // failure, display error message MessageBox.Show(errormsg.ToString(), MessageBoxButtons.OK); } else { // failure, no error, display generic message MessageBox.Show("Connection to LDAP Server Unsuccessful", MessageBoxButtons.OK); } return; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)