[Mono-list] OpenLDAP with mono

Jonathan Stowe jns@gellyfish.com
Wed, 01 Dec 2004 12:39:13 +0000


On Wed, 2004-12-01 at 08:17, Amish Munshi wrote:
> Greetings,
> 
> I am using mono 1.0.4 on Novell Linux desktop, using the article available at 
> 
> http://www.novell.com/coolsolutions/cooldev/features/
> a_net_cplus_ldap_library_cdev.html
> 
> I am trying to connect to OpenLDAP using the following code
> 
> using Novell.Directory.Ldap;
> using System;
> namespace Munshi.Amish.LDAP
> {
> 	class amish
> 	{
> 		static void Main()
> 		{
> 			try {
> 			LdapConnection ldapConn = new LdapConnection();
> 			ldapConn.Connect("localhost",389);
> 			ldapConn.Bind("cn=Manager,ou=my-domain,o=com","secret");
> 			}
> 			catch(Exception e)
> 			{
> 				Console.WriteLine("Error : " + e.ToString());
> 			}
> 		}
> 	}
> }
> 
> I get the following error and the program does not exit.
> 
> Unhandled Exception: System.ArgumentNullException: Argument cannot be null.
> in <0x00078> System.String:FormatHelper 
> (System.Text.StringBuilder,System.IFormatProvider,string,object[])
> in <0x0003d> System.String:Format (System.IFormatProvider,string,object[])
> in <0x00175> Novell.Directory.Ldap.Utilclass.ResourcesHandler:getMessage 
> (string,object[],System.Globalization.CultureInfo)
> in <0x00013> Novell.Directory.Ldap.Utilclass.ResourcesHandler:getMessage 
> (string,object[])
> in <0x000bf> Novell.Directory.Ldap.LdapException:getExceptionString (string)
> in <0x00013> Novell.Directory.Ldap.LdapException:ToString ()
> in <0x00075> Munshi.Amish.LDAP.amish:Main ()


I think if you take the try{} catch{} out you will get a clearer idea of
where the problem lies - this exception appears to be from
LdapException.ToString() which whilst a problem is meaning you are not
seeing what the underlying problem is.


> 
> If I use anonymous bind 
>                         ldapConn.Bind(null,null);
> then the program just freezes and does not exit.
> 
> I tried this on mono 1.0.2 on SuSE 9.2 and the effect the same. What could be 
> wrong?
> 
> 
> Amish.
> 
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
-- 

This e-mail is sponsored by http://www.integration-house.com/