Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 5th, 2005, 04:36 PM
Registered User
 
Join Date: Mar 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dasschmidthaus
Default

Hal,
What I guess I need is the code in the primer you sent me shown in a VB.Net syntax.
Thanx
David

 
Old January 6th, 2005, 12:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

David, I searched google and found the instructions there. I provided you with what came up in those results.

I don't know of a code primer in vb.net for this. As I said, If you have a specific line you don't understand how to convert over - I'll be glad to explain it.



Hal Levy
I am here to help you, not do it for you.
 
Old January 6th, 2005, 06:43 PM
Registered User
 
Join Date: Mar 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dasschmidthaus
Default

Hal,
Here's what I managed to scrap together. I does work, except all it is returning is the properties for the account and not the groups the user is a member of. I haven't been able to find anything that clarifies that part. Can you offer any assistance?
Thanx
David

        Dim strPath As String = "LDAP://servername"
        Dim strMember As String
        Dim strGroup As String

            Dim objEntry As New DirectoryServices.DirectoryEntry(strPath, _
            Me.txtUserName.Text, Me.txtPassword.Text)
            Dim objSearcher = New DirectoryServices.DirectorySearcher(objEntry)

            objSearcher.Filter = "(SAMAccountName=" + Me.txtUserName.Text + ")"
            objSearcher.PropertiesToLoad.Add("cn")

            Dim result As DirectoryServices.SearchResult = objSearcher.FindOne()
            strResult = result.Properties("cn")(0)

            Dim userGroups As New DirectoryServices.DirectoryEntry(strPath, Me.txtUserName.Text, Me.txtPassword.Text)

            MsgBox(strResult & " is a member of : " & userGroups.Name)

            For Each strMember In userGroups.Properties.PropertyNames

                Try
                    strGroup = strMember & ": " & _
                       CType(userGroups.Properties(strMember)(0), String)

                Catch ex As Exception
                    strGroup = strMember & ": " & _
                       "No text representation."

                End Try

                MsgBox(strGroup)

            Next


 
Old January 31st, 2005, 09:14 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Did you solve this? I was slammed at work and couldn't get back to this until right now.



Hal Levy
I am here to help you, not do it for you.
That is, unless you hire me. I am looking for work.
 
Old February 1st, 2005, 03:21 PM
Registered User
 
Join Date: Mar 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dasschmidthaus
Default

Hal,

I think I did. I have to clean up the code some. I'll post it when I do.

Thanx!
David






Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie Help. Login to unique login page per user Kainan Classic ASP Professional 10 May 3rd, 2005 07:47 AM
login failed for user nt authority\anonymous login rj1406 Classic ASP Databases 1 October 24th, 2004 09:15 AM
I can verify user name and password hdoldur Classic ASP Databases 2 April 3rd, 2004 07:51 PM
Login user & restrict access lucian Dreamweaver (all versions) 5 September 7th, 2003 12:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.