We have an LDAP server. All I want to do is to develop a web interface
that will accept a username and password and then authenticate against
our LDAP server. After authenticating I want to retrieve the users
email address. Sounds simple?
Well, stay tuned perhaps not.
The version of the LDAP that is being used here is Sun1 directory
server formerly known as iplanet directory server. The LDAP is
residing on a Unix platform. I am developing my application using
VB.net and the built in class called directory.services. Below is a
sample code. Note, the address provided are valid. The code below does
not work. I get the following error
Stack Trace ...
[COMException (0x80005000): Unknown error (0x80005000)]
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +514
System.DirectoryServices.DirectoryEntry.Bind() +10
System.DirectoryServices.DirectoryEntry.get_AdsObject() +10
System.DirectoryServices.DirectorySearcher.FindAll(Boolean
findMoreThanOne) +199
System.DirectoryServices.DirectorySearcher.FindAll() +10
app1.myldap.Page_Load(Object sender, EventArgs e) in C:\Documents and
Settings\yquazi\VSWebCache\xfiles\app1\myldap.aspx.vb:33
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
It means the directory does not bind.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim objsearch As New
DirectoryEntry("ldap://ldap.ucmerced.edu/ou=People, dc=ucmerced,
dc=edu")
objsearch.AuthenticationType = AuthenticationTypes.None
Dim searcher As New DirectorySearcher(objsearch)
searcher.Filter = "uid=*"
searcher.SearchScope = SearchScope.Subtree
searcher.PropertiesToLoad.Add("uid")
Dim mystring As String = searcher.findone.tostring() |