473,322 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

search special group in active directory by asp.net

hello this is my code could anyone help me, I want to search exact user in special group in active directory, my group name is test11 . could anyone here help me to do this.
thanks this is my code

Public Function ValidateUser(ByVal Domain As String, ByVal username As String, ByVal password As String) As Boolean

Dim strGroupDN As String
strGroupDN = "Users"

Try
Dim de As New DirectoryEntry("LDAP://" & Domain, username, password, AuthenticationTypes.Secure)
Dim srch As New DirectorySearcher(de)

' srch.Filter = "(objectClass=Group)"
'srch.SearchScope = SearchScope.Subtree
'srch.Filter = "(&(ou=hh)(cn=test11))"
srch.Filter = "(&(objectClass=user)(samAccountName=" & username & "))"

de.Invoke("Groups", New Object() {"test11"})
'srch.Filter = "(&(objectCategory=Person)(objectClass=user)(ou=hh )"

' srch.Filter = "(&(objectClass=user)(samAccountName=" & username & ")(memberOf=" & strGroupDN & "))"
Dim result As SearchResult = srch.FindOne

If Not result Is Nothing Then

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
--------------------------------
From: Sara

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>Q7MXSVHElkKpSsjsO5XMUg==</Id>
Nov 20 '05 #1
0 1096

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dirk Hagemann | last post by:
Hi! I asked here a few weeks ago the same question but the answer of Tim Golden didn't really help yet. I'd like to know how to set up a query for all computer-accounts in a special part of...
2
by: Sara | last post by:
Dear Sir, I want to access to a special group in active directory but with this function I could just see that a special user is exist in active directory or not, I mean I want to see that a user...
1
by: rksprst | last post by:
hi, does anyone know of any script which can edit the group attributes in active directory. for use this script to set the group setting such that this group only has access to a specific...
2
by: sgr | last post by:
How do I search an user into the active directory from a c# application? Thanks for all.
4
by: cpajoe2001 | last post by:
I am not sure if this is the proper place to put this thread but I have run into a road block. I am writing a web app that will create groups in Active Directory then add users to those groups. I...
3
by: MuZZy | last post by:
Hi, I'm trying to find a way to call a standard ActiveDirectory search dialog from my C# app, so i can pick a domain or computer user an dreturn it to the app. It's a search like one showing...
0
by: fullmetal87 | last post by:
Hi guys, I am having this problem I want to do a search with wild card e.g. ABC will retrieve all the group XYZABC123 or SKDABC or ABC234KD do anyone know the wildcard character to search??...
3
by: Dirk Hagemann | last post by:
Hi! Does anyone has experience with manipulating MS Active Directory objects? I'd like to delete some users from a group, but so far I couldn't find anything about this. There is some good...
8
maxx233
by: maxx233 | last post by:
I'm trying to get my program checking Active Directory to see if the user is a member of certain groups. I got it working, tested, etc. So I was very surprised when I deployed the program (just...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.