[Mono-list] System.DirectoryServices Problem

JeanOsorio osorio.jean at hotmail.com
Mon Apr 13 12:05:30 EDT 2009


I have this code, to retrieve a user informacion

---------------------------------------------------------------------------
string usuario =  "josorio";
			try{
			DirectoryEntry de = new DirectoryEntry("LDAP://DOMAIN_DESCA", "user",
"password", AuthenticationTypes.Secure);
            object obj = de.NativeObject;
			DirectorySearcher deSearch = new DirectorySearcher();
            deSearch.SearchRoot = de;
            deSearch.Filter = "(samaccountname=" + usuario.Trim() + ")";
            SearchResult results = deSearch.FindOne();
			Console.WriteLine(de.Properties["department"].Value);
			Console.ReadLine();
			}
			catch(Exception ex)
			{
				Console.WriteLine(ex);
			}
--------------------------------------------------------------------------------------

But I get this exception:

LdapException: (91) Connect Error
System.Net.Sockets.SocketException: No such host is known
  at System.Net.Dns.GetHostByName (System.String hostName) [0x00038] in
/usr/src/packages/BUILD/mono-2.4/mcs/class/System/System.Net/Dns.cs:368 
  at System.Net.Sockets.TcpClient.Connect (System.String hostname, Int32
port) [0x00000] in
/usr/src/packages/BUILD/mono-2.4/mcs/class/System/System.Net.Sockets/TcpClient.cs:317 
  at System.Net.Sockets.TcpClient..ctor (System.String hostname, Int32 port)
[0x00006] in
/usr/src/packages/BUILD/mono-2.4/mcs/class/System/System.Net.Sockets/TcpClient.cs:102 
  at Novell.Directory.Ldap.Connection.connect (System.String host, Int32
port, Int32 semaphoreId) [0x0018a] in
/usr/src/packages/BUILD/mono-2.4/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs:800 


the same application works on microsoft framework, I'm working on opensuse,
anybody can tell me if I have to do something to make this work???
-- 
View this message in context: http://www.nabble.com/System.DirectoryServices-Problem-tp23024427p23024427.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list