Fantius
Fantius

Reputation: 3862

How should I access Active Directory from a C# application running on mono in Linux?

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 ()

Upvotes: 4

Views: 3395

Answers (3)

ewall
ewall

Reputation: 28110

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

Microsoft'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.

Upvotes: 2

Lex Li
Lex Li

Reputation: 63254

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

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

Upvotes: 1

Kamran Khan
Kamran Khan

Reputation: 9986

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

alt text http://img441.imageshack.us/img441/2368/test12i.jpg

Upvotes: 0

Related Questions