Exception while querying an AD

S

Sociando

Hi,

I've a problem for querying an LDAP after a while. I mean that the
query method works for a while, and suddenly I've the error, and the
only way I found to make it work again is to log off/ log on !

The error is: An operations error occurred
System.Runtime.InteropServices.COMException
Source "System.DirectoryServices"
StackTrace " at System.DirectoryServices.DirectoryEntry.Bind(Boolean
throwIfFail)\r\n at
System.DirectoryServices.DirectoryEntry.Bind()\r\n at
System.DirectoryServices.DirectoryEntry.get_AdsObject()\r\n at
System.DirectoryServices.DirectorySearcher.FindAll(Boolean
findMoreThanOne)\r\n at
System.DirectoryServices.DirectorySearcher.FindAll()\r\n at
DirectoryLookup.Class1.Query(String path, String filter, String[]
propertiesToLoad)

Here is the code I'm using:

try
{
using (DirectoryEntry de = new DirectoryEntry(_path))
{
using (DirectorySearcher ds = new DirectorySearcher(de))
{
if (filter != null)
ds.Filter = filter;

for (int i = 0; i <= propertiesToLoad.Length - 1; i++)
ds.PropertiesToLoad.Add(propertiesToLoad);

results = ds.FindAll();
}
}
}
catch (Exception e)
{
...

Anyone can help to figure out how I can deal with that?
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top