Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
VB.NET App +ADS +DirectoryEntry/Searcher +AuthenticationTypes.Secure
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Chad Beckner, post: 485967"] Hi everyone, Sorry for cross posting, but I wanted to try and put this where it would be more visible to everyone... :-) I need to find a way to be able to search for entries in our ADS tree. I have it working, but I have to pass it my username/password in order to search it. What I would like to do is pass the username/password to the DirectoryEntry as parameters without having to hard code a username/password. I know how to get the username, but how can I pass the password (i.e. how can I get the password in order to pass it?). For example: strUsername = "UserA" strAuthUsername = "Admin" <--- Hard coded = BAD strAuthPassword = "Password" <--- Hard coded = BAD strDomain = "ADS" strServer = "ads.somewhere.com" strFilter = "" Public Shared Function GetUser_DirectoryEntry(ByVal strUsername As String, ByVal strAuthUsername As String, ByVal strAuthPassword As String, ByVal strDomain As String, ByVal strServer As String, ByVal strFilter As String) As DirectoryEntry Dim strLoginName As String = String.Format("{0}\{1}", strDomain.Trim, strAuthUsername.Trim) Dim deSearchRoot As New DirectoryEntry(String.Format("LDAP://{0}", strDomain.Trim), strLoginName, strAuthPassword.Trim, AuthenticationTypes.Secure) Dim de As DirectoryEntry Try Dim dsUser As DirectorySearcher = New DirectorySearcher(deSearchRoot, String.Format("(&(objectCategory=person)(sAMAccountName={0}))", strUsername.Trim)) Dim srcUser As SearchResultCollection = dsUser.FindAll() If IsNothing(srcUser) Then Throw New Utilities.ExceptionHandler("Could not find user in ADS tree") Else de = srcUser(0).GetDirectoryEntry End If Catch ex As Exception Return Nothing End Try Return de End Function Thanks for any assistance! Chad [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
VB.NET App +ADS +DirectoryEntry/Searcher +AuthenticationTypes.Secure
Top