ASP.Net/File Directory/DirectoryEntry — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 11:51, 26 мая 2010
DirectoryEntry("LDAP://CN=Username, CN=users, DC=DomainName")
<%@ 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>
DirectoryEntry("LDAP://DomainName", Login, Password)
<%@ 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>
DirectoryServices.DirectoryEntry
<%@ 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>