473,805 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(By Val 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, AuthenticationT ypes.Secure)
Dim srch As New DirectorySearch er(de)

' srch.Filter = "(objectClass=G roup)"
'srch.SearchSco pe = SearchScope.Sub tree
'srch.Filter = "(&(ou=hh)(cn=t est11))"
srch.Filter = "(&(objectClass =user)(samAccou ntName=" & username & "))"

de.Invoke("Grou ps", New Object() {"test11"})
'srch.Filter = "(&(objectCateg ory=Person)(obj ectClass=user)( ou=hh)"

' srch.Filter = "(&(objectClass =user)(samAccou ntName=" & 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(e x.Message + ControlChars.Ne wLine + ex.StackTrace)
Return False
End Try
End Function
--------------------------------
From: Sara

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

<Id>Q7MXSVHElkK pSsjsO5XMUg==</Id>
Nov 20 '05 #1
0 1128

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

Similar topics

3
7210
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 Active Directory by using LDAP. Example: all computers with a name like "ABC*" at "..., ou=Production,
2
734
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 is exist in special group which I myself specified not in all of active directory. could you please help me and change this code or show me a method to which could do what I wanted thanks
1
3980
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 folder. same goes for users.
2
1868
by: sgr | last post by:
How do I search an user into the active directory from a c# application? Thanks for all.
4
10929
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 have it creating the groups just fine however when i go to add a user i get. The requested operation did not satisfy one or more constraints associated with the class of the object. (Exception from HRESULT: 0x80072014) And I can not find any help on...
3
5795
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 when you call: rundll32 dsquery,OpenQueryWindow I'm sure there is a Win32 API method to do that but i can't find one.
0
2719
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?? Thanks in advance. For i = 0 To arrList.Count - 1 'Get all members of each group objDirectoryEntry = New DirectoryEntry("WinNT://ABCNT/" & CStr(arrList(i)) & ",group") objIADsMembers =...
3
8187
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 stuff about retrieving data out of the AD (thanks to Tim Golden!), but how can I manipulate or change AD objects like users, computers and groups with Python? Is there somewhere a documentation or some code?
8
2858
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 copying the .exe to their computer as I have in the past) and it wouldn't work for anyone! I've tried it from multiple computers under multiple users, and it only runs under my username, but then works fine from any computer when *I* log in. I had a...
0
10613
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10107
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.