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 3114
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: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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: 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: 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...
|
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: 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...
|
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...
| |