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(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)(!(ou=builtin)(ou=Users)))"
' srch.Filter =
"(&(objectClass=user)(samAccountName=" & username & ")(ou=hh)"
'srch.Filter =
"(&(objectCategory=Person)(objectClass=user)(ou=hh )"
' srch.Filter = "(&(objectClass=user)(samAccountName=" &
username & ")(memberOf=" & strGroupDN & "))"
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 2 3116
Why cross-posting instead of posting to the correct NG?
Please, post VB.NET questions to microsoft.public.dotnet.languages.vb.
Willy.
"Sara" <ra*****@aut.ac.ir> wrote in message
news:ae*************************@posting.google.co m... 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(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)(!(ou=builtin)(ou=Users)))" ' srch.Filter = "(&(objectClass=user)(samAccountName=" & username & ")(ou=hh)"
'srch.Filter = "(&(objectCategory=Person)(objectClass=user)(ou=hh )"
' srch.Filter = "(&(objectClass=user)(samAccountName=" & username & ")(memberOf=" & strGroupDN & "))" 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
Why cross-posting instead of posting to the correct NG?
Please, post VB.NET questions to microsoft.public.dotnet.languages.vb.
Willy.
"Sara" <ra*****@aut.ac.ir> wrote in message
news:ae*************************@posting.google.co m... 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(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)(!(ou=builtin)(ou=Users)))" ' srch.Filter = "(&(objectClass=user)(samAccountName=" & username & ")(ou=hh)"
'srch.Filter = "(&(objectCategory=Person)(objectClass=user)(ou=hh )"
' srch.Filter = "(&(objectClass=user)(samAccountName=" & username & ")(memberOf=" & strGroupDN & "))" 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
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...
|
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...
| |