You need to escape sequence your "/" marks in your string.
 string ldapPath = "ldap:////x500.bund.de:389//o=Bund,c=DE";;

Shuold do it.


On Tue, Sep 13, 2011 at 7:11 AM, JoDeGr8 <[email protected]> wrote:
> Hi,
>
> I am using the following code snippet to connect to a ldap server. The
> moment i call FindAll() I am getting an Unknown error exception.
> Please tell me what am i doing wrong here.
>
> I am developing an C# forms application in VS 2008
> ------------------------------------------------------------------------------------
>
>  string ldapPath = "ldap://x500.bund.de:389/o=Bund,c=DE";;
>
>            DirectoryEntry dEntry = new DirectoryEntry(ldapPath, null,
> null, AuthenticationTypes.Anonymous);
>
>            DirectorySearcher search = new DirectorySearcher(dEntry);
>
>            search.Filter = "(&(objectClass=*))";
>            search.FindAll();
> ----------------------------------------------------------------------------------------------------
>
> Exception trace:
>
>
> System.Runtime.InteropServices.COMException was unhandled
>  Message="Unknown error (0x80005000)"
>  Source="System.DirectoryServices"
>  ErrorCode=-2147463168
>  StackTrace:
>       at System.DirectoryServices.DirectoryEntry.Bind(Boolean
> throwIfFail)
>       at System.DirectoryServices.DirectoryEntry.Bind()
>       at System.DirectoryServices.DirectoryEntry.get_AdsObject()
>       at System.DirectoryServices.DirectorySearcher.FindAll(Boolean
> findMoreThanOne)
>       at System.DirectoryServices.DirectorySearcher.FindAll()
>       at LDAPApp.Form1.button1_Click(Object sender, EventArgs e) in H:
> \Raj\LDAP\LDAPApp\LDAPApp\Form1.cs:line 38
>       at System.Windows.Forms.Control.OnClick(EventArgs e)
>       at System.Windows.Forms.Button.OnClick(EventArgs e)
>       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
>       at System.Windows.Forms.Control.WmMouseUp(Message& m,
> MouseButtons button, Int32 clicks)
>       at System.Windows.Forms.Control.WndProc(Message& m)
>       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
>       at System.Windows.Forms.Button.WndProc(Message& m)
>       at
> System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
>       at
> System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
>       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
> hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
>       at
> System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
>       at
> System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
> dwComponentID, Int32 reason, Int32 pvLoopData)
>       at
> System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
> reason, ApplicationContext context)
>       at
> System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
> reason, ApplicationContext context)
>       at System.Windows.Forms.Application.Run(Form mainForm)
>       at LDAPApp.Program.Main() in H:\Raj\LDAP\LDAPApp\LDAPApp
> \Program.cs:line 18
>       at System.AppDomain._nExecuteAssembly(Assembly assembly,
> String[] args)
>       at System.AppDomain.ExecuteAssembly(String assemblyFile,
> Evidence assemblySecurity, String[] args)
>       at
> Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>       at System.Threading.ThreadHelper.ThreadStart_Context(Object
> state)
>       at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
>       at System.Threading.ThreadHelper.ThreadStart()
>  InnerException:
>
> --
> You received this message because you are subscribed to the Google
> Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
> Web Services,.NET Remoting" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
> or visit the group website at http://megasolutions.net
>



-- 
Stephen Russell

Unified Health Services
60 Germantown Court
Suite 220
Cordova, TN 38018

Telephone: 888.510.2667

901.246-0159 cell

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to