active directory

  • Thread starter Thread starter Ivan G.
  • Start date Start date
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.


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.
 
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.


Arild
 
Hi Arild,

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.

--- Nick
 
Hi, Nick!

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.
??>>>

Me.
 
please post the relevant sections from your web.config file under the web
service folder (with your credentials blanked out).

--- Nick
 
Back
Top