locked
Authenticate user against Active Directory and check if it's an administrator. RRS feed

  • Question

  • User1490168606 posted

    Hi, I'm able to authenticate user against AD but I cannot find how to know if this user is administrator or not, how can I do that? The following code that I use to autheticate users:

               Dim entry As DirectoryEntry = New DirectoryEntry(_path, domainAndUsername, pwd)
    
                Dim obj As Object = entry.NativeObject
                Dim search As DirectorySearcher = New DirectorySearcher(entry)
    
                search.Filter = "(SAMAccountName=" & username & ")"
                search.PropertiesToLoad.Add("HomeDirectory")
                search.PropertiesToLoad.Add("objectGuid")
                Dim result As SearchResult = search.FindOne()
    
                If (result Is Nothing) Then
                    Return False
                End If
    
                           
    


     

    Saturday, March 6, 2010 10:10 AM

All replies

  • User-1040643152 posted

    User.IsInRole("Administrators")

    Saturday, March 6, 2010 3:55 PM
  • User1490168606 posted

    User.IsInRole("Administrators")

     

     

    What is "User"?

    Sunday, March 7, 2010 2:40 PM
  • User-1200560727 posted

    Hi,

    Please go through the following url:

    http://support.microsoft.com/kb/306590

    I hope it will helpful to solve your problem.

    Tuesday, March 23, 2010 1:58 AM