473,545 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help me in active directory search for special group in asp.net

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

my organization unit is "hh"
my group name is "test11"
--------------------------------------------------

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)(!(ou =builtin)(ou=Us ers)))"
' srch.Filter =
"(&(objectClass =user)(samAccou ntName=" & username & ")(ou=hh)"
'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
'Dim obj As DirectoryEntry
If Not result Is Nothing Then
'obj = result.GetDirec toryEntry()

'Response.Write (obj)
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
Nov 22 '05 #1
2 3131
Why cross-posting instead of posting to the correct NG?

Please, post VB.NET questions to microsoft.publi c.dotnet.langua ges.vb.

Willy.

"Sara" <ra*****@aut.ac .ir> wrote in message
news:ae******** *************** **@posting.goog le.com...
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

my organization unit is "hh"
my group name is "test11"
--------------------------------------------------

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)(!(ou =builtin)(ou=Us ers)))"
' srch.Filter =
"(&(objectClass =user)(samAccou ntName=" & username & ")(ou=hh)"
'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
'Dim obj As DirectoryEntry
If Not result Is Nothing Then
'obj = result.GetDirec toryEntry()

'Response.Write (obj)
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

Nov 22 '05 #2
Why cross-posting instead of posting to the correct NG?

Please, post VB.NET questions to microsoft.publi c.dotnet.langua ges.vb.

Willy.

"Sara" <ra*****@aut.ac .ir> wrote in message
news:ae******** *************** **@posting.goog le.com...
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

my organization unit is "hh"
my group name is "test11"
--------------------------------------------------

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)(!(ou =builtin)(ou=Us ers)))"
' srch.Filter =
"(&(objectClass =user)(samAccou ntName=" & username & ")(ou=hh)"
'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
'Dim obj As DirectoryEntry
If Not result Is Nothing Then
'obj = result.GetDirec toryEntry()

'Response.Write (obj)
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

Nov 22 '05 #3

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

Similar topics

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...
1
1351
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...
0
231
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...
1
3696
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am attach this script files and inq files. I cant understand this error. Please suggest me. You can talk with my yahoo id b_sahoo1@yahoo.com. Now i am...
0
7486
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7932
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...
1
7442
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7776
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...
0
6001
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...
1
1905
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
1
1032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
729
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.