Author: dmyst3 | Posted on: 10/31/2009 9:08:33 PM | Views : 733

I have this function that check against AD to see if the user in loginName exist however the code below seems to work only if my development pc is on the Domain. how can i modify this so that it work without having to be on the domain?


Public Function IsExistInAD(ByVal loginName As String) As Boolean
            Dim adpath As String = AppSettings("DefaultActiveDirectoryServer")
            Dim search As New DirectorySearcher()
            search.Filter = [String].Format("(SAMAccountName={0})", loginName)
            search.PropertiesToLoad.Add("cn")
            Dim result As SearchResult = search.FindOne()
      ...

Go to the complete details ...