473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

LDAP search

Good Day Folks,

I'm trying to do LDAP searches, on a Novell eDirectory

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 oSearchResult As SearchResult

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()
oSearchResult=New SearchResult ' COMPILE ERROR IS HERE.

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\sy stem.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: BC30390:
'System.DirectoryServices.SearchResult.Private Sub New(parentCredentials As
System.Net.NetworkCredential, parentAuthenticationType As
System.DirectoryServices.AuthenticationTypes)' is not accessible in this
context because it is 'Private'.

--
Any ideas on how to correct this error and perform the LDAP search ?

Thanks in advance
/Serge
Dec 5 '05 #1
1 1626
The compiler is telling you that you cannot explicitely create a new
instance of the SearchResult class, because its constructor is private (thus
out of reach for your code).

As far as I can see from quickly looking at your code, you don't need to
create an instance of the class. Just a

Dim oSearchResult As SearchResult

should suffice.

The instances will be created automatically by the call to

oSearcher.FindAll()
Hope this helps
"Serge" <Se***@discussions.microsoft.com> wrote in message
news:F5**********************************@microsof t.com...
Good Day Folks,

I'm trying to do LDAP searches, on a Novell eDirectory

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 oSearchResult As SearchResult

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()
oSearchResult=New SearchResult ' COMPILE ERROR IS HERE.

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\sy stem.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: BC30390:
'System.DirectoryServices.SearchResult.Private Sub New(parentCredentials
As
System.Net.NetworkCredential, parentAuthenticationType As
System.DirectoryServices.AuthenticationTypes)' is not accessible in this
context because it is 'Private'.

--
Any ideas on how to correct this error and perform the LDAP search ?

Thanks in advance
/Serge

Dec 5 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Victor Lokhmatov | last post by:
Hello Everyone, My company has asked me to put a company directory on our intranet site and I'm trying to use php to extract the users from our active directory server. I've got everything...
3
by: Dirk Hagemann | last post by:
Hi! I asked here a few weeks ago the same question but the answer of Tim Golden didn't really help yet. I'd like to know how to set up a query for all computer-accounts in a special part of...
7
by: Amar | last post by:
I am trying to connect to my college LDAP directory using ASP.NET. This LDap does not have security as it returns only user demographic information. i do not need to bind with a username or...
0
by: CjB | last post by:
Good Morning, I am having some issues connecting to LDAP through PHP. I am using the function provided here: http://www.php.net/manual/en/function.ldap-bind.php (By 'edi01 at gmx dot at'). I...
2
by: CodeRazor | last post by:
I am trying to create an LDAP connection. I have managed to connect to "LDAP://myServerName" I now want to connect further down the directory tree, to a particular user group. I have tried...
3
by: Dennis Dobslaf | last post by:
I try to do some authentication with LDAP. But it's a bit different to the sample in msdn. I wrote a class LdapAuthentication with a method public bool IsAuthenticated(String domain, String...
10
by: Cruelemort | last post by:
All, I am hoping someone would be able to help me with a problem. I have an LDAP server running on a linux box, this LDAP server contains a telephone list in various groupings, the ldif file of...
1
by: Matrixinline | last post by:
Hi I have a application to search an entry in the LDAP server. I tried to run this application and it runs perfectly. But the issue is I am nnot able to Login to the server and searhc for the...
6
by: hotani | last post by:
I am attempting to pull info from an LDAP server (Active Directory), but cannot specify an OU. In other words, I need to search users in all OU's, not a specific one. Here is what works: con...
2
by: Lars | last post by:
Hi I got some programming experience and I recently started looking into Python. I've read much of the tutorial from 2.6 documentation. But it was more interesting to get started on something I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.