回复 2楼 Maick
我AD域ip 10.1.0.1 域名hssetest 用户test 密码P@ssw0rd
按下面这样写的 保错:捕捉到 System.Runtime.
Message=该服务器不可操作。
Source=System.DirectoryServices
ErrorCode=-2147016646
DirectoryEntry objDE = new DirectoryEntry("LDAP://10.1.0.1", "hssetest\test", "P@ssw0rd", AuthenticationTypes.ServerBind);
DirectorySearcher mySearcher = new DirectorySearcher(objDE);
mySearcher.Filter = ("(SAMAccountName=" + name + ")");
SearchResult s = mySearcher.FindOne();