![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | DirectoryEntry without using admin user: how to check if account'sexpired Hello, Programming in VS2003-ASP.NET 1.1, I have this problem: Using DirectoryEntry and without any admin user, how can I check if a domain account, that try to login, has expired? Scenario: User load web application and login using account and password of the Active Directory. But user account of ActiveDirectory has expired (or password could be expired). For security reason, we don't want to use any account with admin privilegies for connecting through AD. So if user account "jdoe" with password:"jdoe_password" try to login, how to determine if account has expired. Code: Dim Domain As String = "DOMAINXXX" Dim sUserName="jdoe": Dim sPassword="jdoe_password" Dim myEntry As System.DirectoryServices.DirectoryEntry = New System.DirectoryServices.DirectoryEntry("LDAP://" & Domain, sUserName, sPassword, System.DirectoryServices.AuthenticationTypes.Secure) myEntry.Username = sUserName myEntry.Password = sPassword Dim mySearcher As System.DirectoryServices.DirectorySearcher = New System.DirectoryServices.DirectorySearcher(myEntry) Dim myResult As System.DirectoryServices.SearchResult mySearcher.Filter = "(&(objectCategory=person) (objectClass=user)(userPrincipalName=" & UserName & "*))" Dim x as String = myResult.Properties("sAMAccountName")(0) ''<-- it gets 'jdoe' Dim y as String = myResult.Properties("userAccountControl")(0) ''<-- it gets Nothing I don't think it's impossible, or that you have to use an admin user to get that (if you have to use an admin user for connecting to AD, what about security?) Thanks |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Add user - lost the task bar on admin user | General Discussion | |||
| How to set Admin password from an admin user account | Vista General | |||
| Launching process with Admin Credentials with out prompting user for Admin password | PowerShell | |||
| User - Admin - Super Admin | Vista account administration | |||
| Wat is the difference between Built it Admin and Admin User | Vista General | |||