Hi team,
I have custom OU in which users are created and using email as username. Following code is throwing invalid credentials error.
Here are the queries.
1) how to fix this error.
2) if we need to configure it to use custom OU name and email as username.
protected void btnLoginEntity_Click(object sender, EventArgs e) { string server = "AAADVSD0S2-EED.eep.eed.ext"; int port = 636; try { string currentURL = System.Web.HttpContext.Current.Request.Path.ToLower(); string userName = txtUserNameEntity.Text.Trim(); string password = txtPasswordEntity.Text.Trim(); LdapDirectoryIdentifier ldi = new LdapDirectoryIdentifier(server, port); LdapConnection connection = new LdapConnection(ldi); connection.SessionOptions.SecureSocketLayer = true; connection.SessionOptions.VerifyServerCertificate = new VerifyServerCertificateCallback(ServerCallback); connection.Credential = new NetworkCredential(userName, password); connection.AuthType = AuthType.Ntlm; connection.Bind(); //do something } catch (Exception ex) { throw ex; //ask relogin } }