Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 April 24th, 2004, 01:58 AM
Authorized User
 
Join Date: Apr 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sara_1981
Default active directory user Authentication problem

I want to access to a special group in active directory but with this function I could just check 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





Similar Threads
Thread Thread Starter Forum Replies Last Post
web service+active directory+authentication margeb ASP.NET 1.0 and 1.1 Professional 0 November 13th, 2005 09:23 AM
Active Directory Authentication planeswalk General .NET 2 October 27th, 2004 09:43 AM
NT Authentication without Active Directory reyboy SQL Server 2000 0 October 15th, 2003 03:10 AM





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