Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - DirectoryEntry without using admin user: how to check if account'sexpired

Reply
 
Old 08-14-2008   #1 (permalink)
Big Charles


 
 

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 SpecsSystem Spec
Reply

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46