1

I am writing a function to get the user expiration date in C# using ldap. I am currently refering the following link information to get the maxPwdAge from the Properties.

Active Directory user password expiration date .NET/OU Group Policy

Problem with my code is that

var maxPwdAge = results[0].Properties["maxPwdAge"][0]; // Getting Error here
maxDays = (long)maxPwdAge / -864000000000;

in this line, I am getting Error as follows

The time limit for this request was exceeded or "Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation."

I tried IADsLargeInteger also to get the value, but I am getting the same error for the both cases

object obj = entry.Properties["maxPwdAge"];// Getting Error here
ActiveDs.IADsLargeInteger largeIntADSI;
largeIntADSI = (ActiveDs.IADsLargeInteger)obj;

But after nearly 30 secs, I am getting 240 days, the expected result from my code.It is very problematic issue.

Community
  • 1
  • 1
rkP
  • 11
  • 3
  • 1
    Application is not responding or just hung for 30 secs in the var maxPwdAge = results[0].Properties["maxPwdAge"][0]; I couldn't find the root case for this problem. – rkP Mar 19 '14 at 09:24
  • Solved issue as follows ActiveDs.IADsUser native = (ActiveDs.IADsUser)entry.NativeObject; DateTime passwordExpirationDate = native.PasswordExpirationDate; TimeSpan dayLeft = passwordExpirationDate.Date.Subtract(DateTime.Today); daysLeft = dayLeft.Days; – rkP Mar 19 '14 at 09:57

0 Answers0