Phreak
06-17-2002, 06:17 PM
I'm not sure about this, but can ASP interact with Administrative functions on a Win2k server? Such as Active Directory Users and Groups?
ASP w/ Active DirectoryPhreak 06-17-2002, 06:17 PM I'm not sure about this, but can ASP interact with Administrative functions on a Win2k server? Such as Active Directory Users and Groups? Derek Stone 06-17-2002, 06:51 PM Not directly. You'll need a COM object (.dll) to do so. Good Luck -CL Phreak 06-17-2002, 07:00 PM Not trying to get you to write my code or anything (like some people), but what kind of .DLL? Make one in VB and then use it on a webserver through ASP? I'm kind of lost as how you would do this? Do you know anyplace that goes in depth about .DLLs and interacting with win2k? Thanks for your help. darkforcesjedi 06-17-2002, 09:13 PM Try this. It should give you a listing of active directory objects. Replace "LDAP://SERVER/dc=DOMAIN,dc=COM" with appropriate server and domain info. Any username/password combination with privileges to access the directory can do this. WARNING: Do not use this script over the internet, usernames and passwords are NOT encrypted. There is a potential security risk. <body> <% call body() Sub body() on error resume next if request("logout") = 1 then session("uname") = "" session("pword")= "" end if if (request("uname") <> "" and request("pword") <> "") or (session("uname") <> "" and session("pword") <> "") Then if (request("uname") <> "" and request("pword") <> "") then session("uname")=request("uname") session("pword")=request("pword") end if %> <pre><% set conn = createobject("ADODB.Connection") set rs = createobject("ADODB.Recordset") conn.Provider = "ADSDSOObject" conn.Open "ADs Provider",Session("uname"),Session("pword") Set rs = conn.Execute("select * from 'LDAP://SERVER/dc=DOMAIN,dc=COM' where cn='*' or dc='*' or ou='*' order by cn") if err.number <> 0 then call error() If not rs.EOF then response.write "<a href=""ldap.asp?logout=1"">Log Out</a>" & vbcrlf While Not rs.EOF ReturnValue = rs.Fields(0) If IsArray(ReturnValue) Then For I = LBound(ReturnValue) To UBound(ReturnValue) If ReturnValue(I) <> "" Then Response.Write ReturnValue(I) & vbcrlf End If Next Else Response.Write ReturnValue & vbcrlf End If rs.MoveNext Wend Else %>Nothing Returned<% End IF conn.Close set rs=nothing set conn=nothing %></pre> <% else %><form method=post action="ldap.asp"> <table border=0 cellspacing=2 cellpadding=0> <tr><td>Username:</td><td><input type=text name='uname' size=50 value='Format: DOMAIN\User or User@DOMAIN'></td></tr> <tr><td>Password:</td><td><input type=password name='pword' size=50></td></tr> <tr><td><input type=submit value="Log In"></form></td></tr> </table> <% end if end sub sub error() if err.number <> 0 then Select case err.number case -2147217911 Response.write "The login credentials you entered are invalid." Case else response.write "Error " & err.number & ", " & err.description End Select response.write vbcrlf & "Click <a href=""ldap.asp?logout=1"">here</a> to go back." response.end set rs=nothing set conn=nothing session("uname")="" session("pword")="" call body() end if end sub %> </body> |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum