Author: | daniilzaonegin |
---|---|
Assignees: | - |
Labels: | `area-System.DirectoryServices`, `untriaged` |
Milestone: | - |
Closed daniilzaonegin closed 2 years ago
Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014 See info in area-owners.md if you want to be subscribed.
Author: | daniilzaonegin |
---|---|
Assignees: | - |
Labels: | `area-System.DirectoryServices`, `untriaged` |
Milestone: | - |
I've managed to solve it!
It works when you set an option ldap.SessionOptions.ReferralChasing = ReferralChasingOptions.None;
using System;
using System.DirectoryServices.Protocols;
using System.Linq;
using System.Net;
string userAccountName = "<login_to_search>";
string domainName = "<domain_name>";
var endpoint = new LdapDirectoryIdentifier("<fqdn ldap server>", true, false);
// Create a new Ldap connection.
using var ldap = new LdapConnection(endpoint,
new NetworkCredential("<user_name>", "<password_plain_text>"))
{
AuthType = AuthType.Basic
};
ldap.SessionOptions.ProtocolVersion = 3;
ldap.SessionOptions.ReferralChasing = ReferralChasingOptions.None; // <-- this solves the problem!
ldap.Timeout = TimeSpan.FromMinutes(1);
ldap.Bind();
I see, I'm glad you were able to find the workaround. I believe we have seen this before and the issue seems to stem from the fact that you are searching on the root of the ldap directory.
Description
I'm trying to perform a search request using
System.DirectoryServices.Protocols
. Here is my code (it works successfully on windows, but fails on linux docker container):csproj
Exception (happens in a docker container on linux):
Reproduction Steps
Run the code above in description
Expected behavior
Code works on linux container
Actual behavior
Receive an exception
Regression?
No response
Known Workarounds
No response
Configuration
On my windows machine
In a container
Other information
No response