Password and LDAP

Discussion in 'ASP .Net Security' started by ABUnNOUR, Sep 27, 2005.

  1. ABUnNOUR

    ABUnNOUR Guest

    hi
    how can i know the expiry date for users PASSWORD in active directory
    ?

    i want to detect the date to notify the user about ?

    am using Asp.net with C# in my application .. So can you please tell me
    how ?
    ABUnNOUR, Sep 27, 2005
    #1
    1. Advertising

  2. Use this .

    First parameter domain path (e.g. LDAP://Domain)
    second parameter userPath (e.g. LDAP://Domain/CN=<username> ...)

    public DateTime GetDomainPasswordExpiration(string domainPath, string
    userPath)
    {
    DirectoryEntry domain = new DirectoryEntry(domainPath);
    DirectoryEntry user = new DirectoryEntry(userPath);

    LargeInteger pwdLastSet =
    (LargeInteger)user.Properties["pwdLastSet"].Value;
    LargeInteger maxPwdAge =
    (LargeInteger)domain.Properties["maxPwdAge"].Value;

    long daysL = (((long)maxPwdAge.HighPart<<32) + maxPwdAge.LowPart);
    long dt = (((long)(pwdLastSet.HighPart) << 32) + (long)
    pwdLastSet.LowPart) - daysL;
    return DateTime.FromFileTime(dt);
    }


    You have to make a reference to "ActiveDS Type Library" (COM)
    Tasos Vogiatzoglou, Sep 27, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    514
    Raymond DeCampo
    Feb 21, 2006
  2. rcmn
    Replies:
    1
    Views:
    327
    =?ISO-8859-1?Q?Michael_Str=F6der?=
    Nov 6, 2006
  3. AAaron123
    Replies:
    2
    Views:
    2,091
    AAaron123
    Jan 16, 2009
  4. AAaron123
    Replies:
    1
    Views:
    1,312
    Oriane
    Jan 16, 2009
  5. Jason Wold

    using LDAP Controls in ruby-ldap

    Jason Wold, Nov 4, 2004, in forum: Ruby
    Replies:
    5
    Views:
    228
Loading...

Share This Page