My solution is just a guess, kindly ignore it, if you're sure this requirements are met.
To query the directory you need an user who's allowed to bind to the LDAP tree else the directory server must allow anonymous binds.
While you're debugging your application on your local machine this requirement is full-filled (at least I assume you're using an AD account).
Things might look different for your web server, do you know if it is even member of your domain?
Try the following:
Create a DirectoryEntry
public DirectoryEntry (
Use this ctor for your DirectorySearcher
Kindly let me know, if that was helpful.