Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active Directory

Status
Not open for further replies.

RobPa

Programmer
Nov 2, 2001
14
CA
I'm writing an ASP Application for our corporate intranet. I'd like to be able to pull user information from the active directory. Specifically group membership.

Has anyone ever done this? How would I do it?

I'm not really sure where to start. I've searched the web and found nothing.

Any Help would be appreciated.
 
If you are accustomed to using ADO to retrieve data from databases such as Microsoft Access or SQL Server, Microsoft has an OLE DB provider for Directory Services. You should be able to make an ADO connection to the Directory and use ADO records or recordsets to get at the data.
 
hey there! do you have an example of a sql statment to use? or even links to resources on the web. i'm having a heck of a time finding any info about this other then the connection string. i can conect, but i have no idea what the fields or tables would be, or if i can add my own fields to customize the data. any help is VERY MUCH appreciated!!
-jacob
 
I wrestled with this. Eventually, I found this worked:

<%
Set grp = GetObject(&quot;WinNT://DOMAIN/DomainGroup&quot;)
For each usr in grp.Members
Response.Write usr.Name
Next
%>

I needed the page to display things dynamically, depending on whether or not a person was a member of a group. Here's how I tested:

<%
Set grp = GetObject(&quot;WinNT://DOMAIN/DomainGroup&quot;)
For each usr in grp.Members
if &quot;DOMAIN\&quot; & usr.Name = request.servervariables(&quot;AUTH_USER&quot;) then
Response.Write &quot;You are authenticated&quot;
else
Response.Write &quot;Go Away&quot;
end if
Next
%>

I believe you need Integrated Windows Authorization turned on, and anonymous access turned off for the second script to work.
 
loganginger, what kind of authorization did you have to do in order to have your scrpts work? I have tried with Integrated Windows Authorization turned on, and anonymous access turned off, but I still get a HTTP 500 - Internal server error. Does some sort of Domain Policy need to be in place for an ASP page to read from the AD? What sort of &quot;wrestling&quot; did you have to do to get the scripts to work? Any help would be appriciated.

Thanks

-attGreg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top