views:

87

answers:

1

I am having an issue with the DirectoryEntry object where it's taking a long time trying to connect to to a dead AD server and eventually failing. Is it possible to set a timeout so that if its not able to connect within a specific time, it just comes out to try the next one?

A: 

There is no timeout option for DirectoryEntry directly.

You can use DirectorySearcher and set the ClientTimeout (even if you're only looking for one object by path). Or do your directory operation on a new thread or BackgroundWorker and control your own timeout.

ScottBai