In an ASP.NET application, you may need to supply a domain name in your
binding string and some valid credentials in the username and password
parameters. The issue is that in ASP.NET, it is often the case that you are
running under a local machine account whose credentials cannot be used to
access AD directly.
Essentially, what you will want to do is read the Context.User.Identity.Name
property in ASP.NET to get the current user name (will be domain\username),
then pull off the username part and use that in a search filter to search
the domain for that user. The filter would look like
(sAMAccountName=username)
Using PropertiesToLoad on the DirectorySearcher, you can specify which AD
attributes you wish to retrieve and get them back in a SearchResult object.
Depending on the structure of your AD, you may want to search at the domain
level or do a global catalog search at the forest level
(GC://domain.com/xxxxx), depending on whether multiple domains are involved.
HTH,
Joe K.