SirReadAlot
asked on
Querying Ldap ou folders with c#
Hi Experts,
I have this piece of code which querys one OU Folder and works. how do i query two OU folders to ensure that all users are accounted for?
-------------------------- --------
string userDN = "CN=" + Username.Value + ", OU=IS, OU=TY O=HCFHE"; // Change to match your Distinguished Name (DN)
-------------------------- ---------- -
Also why is it that just the parent [O=HCFHE] can not be queried?
thanks
I have this piece of code which querys one OU Folder and works. how do i query two OU folders to ensure that all users are accounted for?
--------------------------
string userDN = "CN=" + Username.Value + ", OU=IS, OU=TY O=HCFHE"; // Change to match your Distinguished Name (DN)
--------------------------
Also why is it that just the parent [O=HCFHE] can not be queried?
thanks
protected void Login_Click(object sender, EventArgs e)
{
string userDN = "CN=" + Username.Value + ", OU=IS, O=HCFHE"; // Change to match your Distinguished Name (DN)
LdapConnection ldapConn = new LdapConnection();
ldapConn.Connect("****", ***);
try
{
ldapConn.Bind(userDN, Password.Value);
FormsAuthentication.RedirectFromLoginPage(Username.Value, PersistCookie.Checked);
}
catch (LdapException)
{
lblMsg.Text = "Incorrect username/password combination.";
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
if ((userDN = "CN=" + Username.Value + ", OU=IS, O=HCFHE") || (userDN = "CN=" + Username.Value + ", OU=EaST, O=HCFHE"))
{
LdapConnection ldapConn = new LdapConnection();
ldapConn.Connect("10.1.1.2
Error 1 Operator '||' cannot be applied to operands of type 'string' and 'string'
thanks