开发者

what does mean with AccountExpirationDate?

what does mean with AccountExpirationDate ?does this mean that accolunt will be deleted after this period?i want to delete the account programaticlly after a specific period.

here my code snippet :

    void _createUserAccount(String User, String Pass, DateTime expirationDate)
{
    PrincipalContext pc = new PrincipalContext(ContextType.Machine);
    System.DirectoryServices.AccountManagement.UserPrincipal u = new UserPrincipal(pc);
    u.SetPassword(Pass);
    u.Name = User;
    u.Description = "New User";
    u.UserCannotChangePassword = true;
    u.PasswordNeverExpires = false;
    u.AccountExpirationDate = expirationDate;

    u.Save();
}

and开发者_开发技巧 in page_load ;i am calling this method:

_createUserAccount(Request.QueryString["UserName"].ToString(), Request.QueryString["Password"].ToString(), Convert.ToDateTime(Request.QueryString["ExpireDate"].ToString()));

but after the period ended ;i checked the users account on my PC and found the account still exists.

any idea??


No, it just means that the account will be deactivated and placed in an "expired" state after the given date. If you really want the account deleted, you will have to do that manually.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜