ASP.Net/File Directory/DirectoryEntry
DirectoryEntry("LDAP://CN=Username, CN=users, DC=DomainName")
<source lang="csharp">
<%@ Page %> <script Language="vb" runat="server"> Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim User As System.DirectoryServices.DirectoryEntry Try User = New System.DirectoryServices.DirectoryEntry("LDAP://CN=Username, CN=users, DC=DomainName") Dim Value As String Value = User.Properties("HomeNumber").Item(0) Catch "Show error message Finally User.Close() End Try
End Sub </script>
</source>
DirectoryEntry("LDAP://DomainName", Login, Password)
<source lang="csharp">
<%@ Page %> <script Language="vb" runat="server"> Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
If Not ValidateUser("Login", "Password") Then End If
End Sub Function ValidateUser(ByVal Login As String, ByVal Password As String) As Boolean
Dim Entry As DirectoryEntry Try Entry = New DirectoryEntry("LDAP://DomainName", Login, Password) Dim Search As DirectorySearcher = New DirectorySearcher(Entry) Dim results As SearchResult = Search.FindOne Return True Catch Return False Finally Entry.Close() End Try
End Function </script>
</source>
DirectoryServices.DirectoryEntry
<source lang="csharp">
<%@ Page %> <script Language="vb" runat="server"> Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim Entry As System.DirectoryServices.DirectoryEntry Try Entry = New System.DirectoryServices.DirectoryEntry("WinNT://DomainName") Catch "Error message Finally Entry.Close() End Try
End Sub </script>
</source>