When i run the code below, i get this:

Exception Details: Novell.Directory.Ldap.LdapException: 49

Source Error:
Line 35: ldapConn.Bind(userDN, userPasswd); Line 36:

Below is the full code:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Authentication;
using Novell.Directory.Ldap;
using System.DirectoryServices;
using System.Net;

namespace WebApplication1
public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)


protected void login_Click(object sender, EventArgs e)
string userDN = "cn=" + usernametxt.Text;
string userPasswd = passwordtxt.Text;
string searchBase = "o=University";
string searchFilter = "objectClass=*";
// Creating an LdapConnection instance
LdapConnection ldapConn = new LdapConnection();

//Connect function will create a socket connection to the server
ldapConn.Connect("", 389);

//Bind function will Bind the user object Credentials to the Server

ldapConn.Bind(userDN, userPasswd);

// Searches in the Marketing container and return all child entries just below this
//container i.e Single level search
LdapSearchQueue queue = ldapConn.Search(searchBase,

LdapMessage message;
while ((message = queue.getResponse()) != null)
if (message is LdapSearchResult)
LdapEntry entry = ((LdapSearchResult)message).Entry;
System.Console.Out.WriteLine("\n" + entry.DN);
System.Console.Out.WriteLine("\tAttributes: ");
LdapAttributeSet attributeSet = entry.getAttributeSet();
System.Collections.IEnumerator ienum = attributeSet.GetEnumerator();
while (ienum.MoveNext())
LdapAttribute attribute = (LdapAttribute)ienum.Current;
string attributeName = attribute.Name;
string attributeVal = attribute.StringValue;
Console.WriteLine(attributeName + "value:" +attributeVal);



spyxdaxworld's Profile: http://forums.novell.com/member.php?userid=122409
View this thread: http://forums.novell.com/showthread.php?t=450596