views:

210

answers:

3

My code will run in Windows (non-mono) and in Linux (mono). Currently, I am using System.DirectoryServices, which works great in Windows. But in Linux:

System.NullReferenceException: Object reference not set to an instance of an object
  at System.DirectoryServices.DirectorySearcher.InitBlock () [0x00000] 
  at System.DirectoryServices.DirectorySearcher.DoSearch () [0x00000] 
  at System.DirectoryServices.DirectorySearcher.get_SrchColl () [0x00000] 
  at System.DirectoryServices.DirectorySearcher.FindOne () [0x00000] 
  at (wrapper remoting-invoke-with-check) System.DirectoryServices.DirectorySearcher:FindOne ()
A: 

Besides that you may want to try hacking Novell example solutions; I think it comes under the "not yet implemented category".

alt text

KMan
+2  A: 

Disclaimer: I haven't done it myself, but...

Micro$oft's implementation of the System.DirectoryServices namespace is basically a wrapper around their proprietary DLLs. The Mono project has put a lot of effort into making their DirectoryServices code work with more than just Microsoft AD, but it may not be "all there" yet.

I have seen that at least a few people have preferred to use Novell's Open Source library for LDAP access instead; a full and detailed tutorial is available here.

ewall
I have seen that Novell implementation page, but I can't download the library because forge.novell.com is not responding today or yesterday.
Fantius
+1  A: 

RemObjects also has a LDAP implementation in their Internet Pack for .NET,

http://blogs.remobjects.com/blogs/ck/2010/02/08/p1043

Lex Li
This looks like it should work. But there is very little documentation. Do you know of any sample code?
Fantius
Once installed, you can find the samples. Since the source code is available, you can somehow review everything.
Lex Li
I've got this working now. But I have to explicitly set my credentials. Do you know if there is a way to use the current authenticated Windows user's credentials (at least when you are in Windows). I suppose I could use System.DirectoryServices when in Windows and RemObjects when in Linux.
Fantius
I did not do much LDAP work, so I am not sure how to use current credentials. Can you create a code.RemObjects.com account and report your request here, http://code.remobjects.com/p/internetpack/issues/? I believe the RO guys are happy to assist.
Lex Li