【问题标题】:Password Last Set Time incorrect - Active Directory密码上次设置时间不正确 - Active Directory
【发布时间】:2011-08-14 06:14:01
【问题描述】:

我有一个方法允许我通过将用户名作为变量传递来设置用户的活动目录密码。设置密码后,我正在检查是否超过 5 分钟才允许再次重置密码。我设置了断点,当我查看密码上次设置的时间(运行修改用户方法 1 次后)时,时间设置为未来 4 小时。有什么想法吗?

谢谢,

杰森

if(DateTime.Now.Subtract(PasswordLastSet).TotalMinutes > 5)


public void ModifyUser(string username)
    {
        string sPwd = SetSecurePassword();

        DirectoryEntry entry = GetDirectoryEntry();
        DirectorySearcher search = new DirectorySearcher(entry);
        search.Filter = "(SAMAccountName=" + username + ")";

        SearchResult sResult = search.FindOne();
        if (sResult != null)
        {
            try
            {
                DirectoryEntry updateEntry = sResult.GetDirectoryEntry();
                updateEntry.Invoke("SetPassword", new object[] { sPwd });
                updateEntry.CommitChanges();
                updateEntry.Close();
                passWord = sPwd.ToString();

            }


            catch (Exception ex)
            {
                lblErrorMessage.Text = ex.ToString();
            }
        }

【问题讨论】:

    标签: c# asp.net active-directory


    【解决方案1】:

    查看密码上次设置时间时获取本地时间

    【讨论】:

      【解决方案2】:

      这很可能是因为您的时区。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-05-21
        • 2012-12-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多