AD Lookup Problem - Security?

S

SethMW

Hi,

I have a form where I need to lookup some user info OnLoad, and I am having
some issues. I don't know much about AD, but I suspect this is a permission
type problem.

In my form, I have the code below. This works fine from my VPC where I am
developing this, and it works fine in our production environment when opened
with InfoPath, but it gives a cryptic error when opening it in a browser. I
can get more information on the error, if need be, but I suspect it has to do
with the account the browser form is running as, and querying AD with. Is
there anything I need to do to allow a browser based IP form to query AD?

Anyway, here's a summary of my code, if we need to look there...

DirectoryEntry entry = new DirectoryEntry();
entry.Path = _ldapPath;
entry.AuthenticationType = AuthenticationTypes.Secure;

DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + account + ")";
search.PropertiesToLoad.Add("givenName");
search.PropertiesToLoad.Add("sn");
search.PropertiesToLoad.Add("initials");
search.PropertiesToLoad.Add("telephoneNumber");
search.PropertiesToLoad.Add("manager");

string manager;

if (result != null)
{
manager = result.Properties["manager"][0].ToString();

search = new DirectorySearcher(entry);
search.Filter = "(distinguishedName=" + manager + ")";
search.PropertiesToLoad.Add("SAMAccountName");

result = search.FindOne();

string manager =
result.Properties["SAMAccountName"][0].ToString());
}


Any help would be greatly appreciated.
Seth
 
B

BobCh

A more flexible approach for us was to use SQL server and a web
service (you could perhaps just use a web service) that queried a list
of AD accounts replicated to the SQL database.

This is a common approach for many applications.

/bac
 

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

Top