G
Guest
Good Day Folks,
I'm trying to do LDAP searches, on a Novell eDirectory. I made the change
someone suggested, but now I'm getting a differenct error.
I have an LDAP class defined as follows
' Contents of LDAPAuthentication.vb
<script language="VB" runat="server">
Public Class LdapAuthentication
Private _path As String
Private _ldapDirlisting as string
Public Property ldapDirlisting As String
Get
Return _ldapDirlisting
End Get
Set(ByVal Value As String)
_ldapDirlisting = Value
End Set
End Property
Public Sub New(ByVal path As String)
_path = path
_ldapDirlisting=Nothing
End Sub
Sub GetDirectoryEntries()
dim oConnection As New DirectoryEntry(_path)
dim oSearcher As New DirectorySearcher(oConnection)
dim oSearchResults As SearchResultCollection()
dim oSearchResult As SearchResult
oSearcher.Filter = "(objectClass=user)"
oSearchResults = oSearcher.FindAll()
For Each oSearchResult In oSearchResults
_ldapDirlisting &= oSearchResult.Properties("name").ToString &
","
Next
End Sub
End Class
</script>
' Contents of LDAPAuthentication.vb ends here
------------------
' Contents of ASP.NET script which calls the class listed above.
<%@ Page Language="vb" AutoEventWireup="false"
CompilerOptions='/R:"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\system.directoryservices.dll"' Debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.DirectoryServices" %>
<!--#include file="LDAPAuthentication.vb"-->
<html>
<body>
<%
Const LDAPPath As String = "LDAP://grnbds2.ocdsb.edu.on.ca/ou=GREENBANK,
ou=DIST5, o=OCDSB"
dim myldap as LdapAuthentication=new LdapAuthentication(LDAPPath)
myldap.GetDirectoryEntries()
response.write(myldap.ldapDirlisting)
%>
</body>
</html>
I'm getting the following error message
Compiler Error Message: BC30311: Value of type
'System.DirectoryServices.SearchResultCollection' cannot be converted to
'1-dimensional array of System.DirectoryServices.SearchResultCollection'.
--
Any ideas on how to correct this error and perform the LDAP search ?
Thanks in advance
/Serge
I'm trying to do LDAP searches, on a Novell eDirectory. I made the change
someone suggested, but now I'm getting a differenct error.
I have an LDAP class defined as follows
' Contents of LDAPAuthentication.vb
<script language="VB" runat="server">
Public Class LdapAuthentication
Private _path As String
Private _ldapDirlisting as string
Public Property ldapDirlisting As String
Get
Return _ldapDirlisting
End Get
Set(ByVal Value As String)
_ldapDirlisting = Value
End Set
End Property
Public Sub New(ByVal path As String)
_path = path
_ldapDirlisting=Nothing
End Sub
Sub GetDirectoryEntries()
dim oConnection As New DirectoryEntry(_path)
dim oSearcher As New DirectorySearcher(oConnection)
dim oSearchResults As SearchResultCollection()
dim oSearchResult As SearchResult
oSearcher.Filter = "(objectClass=user)"
oSearchResults = oSearcher.FindAll()
For Each oSearchResult In oSearchResults
_ldapDirlisting &= oSearchResult.Properties("name").ToString &
","
Next
End Sub
End Class
</script>
' Contents of LDAPAuthentication.vb ends here
------------------
' Contents of ASP.NET script which calls the class listed above.
<%@ Page Language="vb" AutoEventWireup="false"
CompilerOptions='/R:"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\system.directoryservices.dll"' Debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.DirectoryServices" %>
<!--#include file="LDAPAuthentication.vb"-->
<html>
<body>
<%
Const LDAPPath As String = "LDAP://grnbds2.ocdsb.edu.on.ca/ou=GREENBANK,
ou=DIST5, o=OCDSB"
dim myldap as LdapAuthentication=new LdapAuthentication(LDAPPath)
myldap.GetDirectoryEntries()
response.write(myldap.ldapDirlisting)
%>
</body>
</html>
I'm getting the following error message
Compiler Error Message: BC30311: Value of type
'System.DirectoryServices.SearchResultCollection' cannot be converted to
'1-dimensional array of System.DirectoryServices.SearchResultCollection'.
--
Any ideas on how to correct this error and perform the LDAP search ?
Thanks in advance
/Serge