Answered by:
Find LDAP connection domain

Question
-
Is there any way to find the user's server name to use in the ldap connection to active directory? Like I want to automatically when a user uses the program to use the domain they are logged in i.e. domain.com and put that in the ldap string?
Dim dirEntry As DirectoryEntry = New DirectoryEntry("LDAP://userDomainNetwork.com")
- Edited by vkid12 Tuesday, December 9, 2014 7:38 PM
Tuesday, December 9, 2014 7:11 PM
Answers
-
If I understand your question is sounds like you want the LDAP Distinguished Name (DN):
Dim RootDSE As New DirectoryServices.DirectoryEntry("LDAP://RootDSE") Console.WriteLine(RootDSE.Properties("DefaultNamingContext").Value)
Paul ~~~~ Microsoft MVP (Visual Basic)
- Proposed as answer by Youjun Tang Wednesday, December 17, 2014 7:41 AM
- Marked as answer by Youjun Tang Friday, December 19, 2014 9:37 AM
Tuesday, December 9, 2014 7:44 PM
All replies
-
Tuesday, December 9, 2014 7:14 PM
-
What I meant was, the server name and not the domain name, sorry.
- Edited by vkid12 Tuesday, December 9, 2014 7:38 PM
Tuesday, December 9, 2014 7:24 PM -
If I understand your question is sounds like you want the LDAP Distinguished Name (DN):
Dim RootDSE As New DirectoryServices.DirectoryEntry("LDAP://RootDSE") Console.WriteLine(RootDSE.Properties("DefaultNamingContext").Value)
Paul ~~~~ Microsoft MVP (Visual Basic)
- Proposed as answer by Youjun Tang Wednesday, December 17, 2014 7:41 AM
- Marked as answer by Youjun Tang Friday, December 19, 2014 9:37 AM
Tuesday, December 9, 2014 7:44 PM