title: LDAP Authentication The specified domain either does not exist or could not be contacted
body: <p>I got the following error</p>
  
  <blockquote>
    <p>{"The specified domain either does not exist or could not be
    contacted. "}</p>
  </blockquote>
  
  <p>at the line</p>
  
  <pre><code> Dim adResults = adSearch.FindOne.Path
  </code></pre>
  
  <p>Can anyone suggest why it is ? Seeing the below code</p>
  
  <pre><code>Dim ID As FormsIdentity = DirectCast(User.Identity, FormsIdentity)
      Dim ticket As FormsAuthenticationTicket = ID.Ticket
      Dim adTicketID As String = ticket.Name
      Dim adSearch As New DirectorySearcher
      adSearch.Filter = ("(userPrincipalName=" &amp; adTicketID &amp; ")")
      Dim adResults = adSearch.FindOne.Path
      Dim adResultsDirectory As New DirectoryEntry(adResults)
      Dim found As Boolean = False
      For Each entry In adResultsDirectory.Properties("memberOf")
          Response.Write(entry)
          Response.Write("&lt;br/&gt;")
          If entry = "CN=GroupName,CN=UserGroup,DC=my,DC=domain,DC=com" Then
              found = True
          End If
  
      Next
      If Not (found) Then
          Response.Redirect("login.aspx")
      End If
  </code></pre>