[英]Detect if user must reset password In Active Directory
I am trying to detect if a user must reset his password in Active Directory. 我正在尝试检测用户是否必须在Active Directory中重置其密码。 I'm using a console app written in C#. 我正在使用用C#编写的控制台应用程序。
I have virtual dedicated server on GoDaddy I am trying to run 我正在尝试运行GoDaddy上的虚拟专用服务器
string strUserName = userName;
user = new DirectoryEntry("LDAP://0.0.0.0", "GodadyLogiUserInfo", "GodadyLogiUserPass", AuthenticationTypes.Secure);
DirectorySearcher searcher = new DirectorySearcher(user);
searcher.Filter = "(SAMAccountName=" + <USERWHICHNEEDTOTEST>+ ")";
searcher.CacheResults = false;
// Find user
SearchResult result = searcher.FindOne();
user = result.GetDirectoryEntry();
It throws error 引发错误
The server is not operational. 服务器无法运行。
I tried many ways on SOF and many sites but could not find. 我在SOF和许多站点上尝试了许多方法,但是找不到。
LDAP://0.0.0.0
is a valid address for the server to listen at. LDAP://0.0.0.0
是服务器侦听的有效地址。 It isn't a valid address for a client to try to connect to. 客户端尝试连接的地址无效。 You have to supply a proper hostname or IP address. 您必须提供正确的主机名或IP地址。
Just try to connect AD like this : 只需尝试像这样连接AD:
/* Connexion to Active Directory
*/
string sFromWhere = "LDAP://ServerDnsName:389/dc=dom,dc=..";
DirectoryEntry deBase = new DirectoryEntry(sFromWhere, "ADUser", "ADPwd");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.