Use the DirectorySearcher object from the System.DirectoryServices
namespace. Make sure you pass a username and password to the construcor of
the root (DirectoryEntry) for the search since the webservice itself does
not have access.
All you need is a username and password to an account you create in your AD
that you use only to access AD.
The problem with this is that any user accessing the webservice will get the
access to all the same objects. If you need the results to vary depending on
WHO is accessing the webservice, then you will need to do some
authentication in the webservice so that you get a valid login or
impersonation token.
For regular ASP.NET apps this means enabling impersonation in the web.config
and enabling basic authentication on the website. I've never written a
webservice myself, but I guess there are similar ways of doing it.
Using impersonation in the web service is exactly the same as it is in
ASP.NET.
This will allow Ivan's code to access the Active Directory with the
credential supplied.
Yes, but it works only in ASP.NET Web Applications not in web services. I
don't know why.
NM> Using impersonation in the web service is exactly the same as it is in
NM> ASP.NET.
NM> This will allow Ivan's code to access the Active Directory with the
NM> credential supplied.
NM> --- Nick
NM> ??>> All you need is a username and password to an account you create in
??>> your
NM> AD
??>> that you use only to access AD.
??>>
??>> The problem with this is that any user accessing the webservice will
??>> get
NM> the
??>> access to all the same objects. If you need the results to vary
??>> depending
NM> on
??>> WHO is accessing the webservice, then you will need to do some
??>> authentication in the webservice so that you get a valid login or
??>> impersonation token.
??>>
??>> For regular ASP.NET apps this means enabling impersonation in the
NM> web.config
??>> and enabling basic authentication on the website. I've never written a
??>> webservice myself, but I guess there are similar ways of doing it.
??>>
??>> Arild
??>>
??>> ??>>> Hi, Arild!
??>>>
??>>> What if I don't know username and password? How can I do that without
??>>> them?
??>>>
AB>>>> Arild
??>>>
AB>>>> ??>>>>> Hi.
??>>>>>
??>>>>> How to make a query to active directory from web service?
??>>>>>
??>>>>> Thanx.
??>>>>>
??>>> Me.
??>>>
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.