Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 24th, 2004, 01:36 AM
Authorized User
 
Join Date: Apr 2004
Location: tehran, , Iran.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sara_1981
Default web application, get group name - active directory

I want to access to a special group in active directory but with this function I could just that a special user is exist in active directory or not, I mean I want to see that a user is exist in special group which I myself specified. could anyone help me and change this code to which could do what I want.
thanks
    Public Function ValidateUser(ByVal Domain As String, ByVal username As String, ByVal password As String) As Boolean
        Dim dehelp As String
        dehelp = "LDAP://"
        Try
            Dim de As New DirectoryEntry(dehelp & Domain, username, password, AuthenticationTypes.Secure)

            Dim srch As New DirectorySearcher(de)



            'srch.Filter = "(objectClass=Group)"
            srch.Filter = "(&(objectClass=user)(samAccountName=" & username & "))"
            Dim result As SearchResult = srch.FindOne
            'Dim obj As DirectoryEntry
            If Not result Is Nothing Then
                'obj = result.GetDirectoryEntry()
                'Response.Write(obj)

                Return True
            Else
                Return False
            End If
        Catch ex As Exception
            Console.Write(ex.Message + ControlChars.NewLine + ex.StackTrace)
            Return False
        End Try
    End Function

Regards
Sara
__________________
Regards
Sara
Closed Thread


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add user to group - Active Directory anurag_ur ASP.NET 2.0 Professional 0 January 17th, 2006 01:54 AM
Add user to group - Active Directory anurag_ur ASP.NET 1.0 and 1.1 Professional 0 January 16th, 2006 08:25 AM
Add User to group - Active Directory anurag_ur .NET Framework 1.x 0 January 16th, 2006 08:15 AM
Add User to group - Active Directory anurag_ur C# 0 January 16th, 2006 08:13 AM
Add User to group - Active Directory anurag_ur ASP.NET 1.0 and 1.1 Basics 0 January 16th, 2006 08:13 AM



All times are GMT -4. The time now is 10:13 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.