J
John Smith
I am converting my old ASP domain account manager to .Net / C# and having
problems returning some of the properties such as "PasswordLastChanged" and
"AccountExpirationDate". These properties are provided by the NT provider
and not LDAP, if I'm not mistaken. In my ASP code, I simply use the
following code to return the values:
Set objUser = GetObject("WinNT://domain/joe_user")
lastChanged = objUser.PasswordLastChanged
acctExpire = objUser.AccountExpirationDate
Set objUser=Nothing
So, in my C# code, I'm calling the WinNT provider as follows:
DirectoryEntry deMain = new DirectoryEntry();
deMain.Path = "WinNT://domain/"+Request.QueryString["userid"];
and I'm trying to retrive the properties with:
strLastChanged = deMain.Properties["PasswordLastChanged"][0].ToString();
strAcctExpire = deMain.Properties["PasswordLastChanged"][0].ToString();
but it's returning this error:
System.ArgumentOutOfRangeException: Specified argument was out of the range
of valid values. Parameter name: Index was out of range. Must be
non-negative and less than the size of the collection
The ASP code works fine. Any help is greatly appreciated.
Thanks
problems returning some of the properties such as "PasswordLastChanged" and
"AccountExpirationDate". These properties are provided by the NT provider
and not LDAP, if I'm not mistaken. In my ASP code, I simply use the
following code to return the values:
Set objUser = GetObject("WinNT://domain/joe_user")
lastChanged = objUser.PasswordLastChanged
acctExpire = objUser.AccountExpirationDate
Set objUser=Nothing
So, in my C# code, I'm calling the WinNT provider as follows:
DirectoryEntry deMain = new DirectoryEntry();
deMain.Path = "WinNT://domain/"+Request.QueryString["userid"];
and I'm trying to retrive the properties with:
strLastChanged = deMain.Properties["PasswordLastChanged"][0].ToString();
strAcctExpire = deMain.Properties["PasswordLastChanged"][0].ToString();
but it's returning this error:
System.ArgumentOutOfRangeException: Specified argument was out of the range
of valid values. Parameter name: Index was out of range. Must be
non-negative and less than the size of the collection
The ASP code works fine. Any help is greatly appreciated.
Thanks