| | |
Active Directory- extracting groups
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hello!
I am currently doing some authentication in Active Directory.
Our AD is running in Windows 2008 Server and I manage to log-in based in our AD. However I also want to get the group where the user belongs. but I don't know how. Can anyone help me?
here is the authentication in AD I copied...
I am currently doing some authentication in Active Directory.
Our AD is running in Windows 2008 Server and I manage to log-in based in our AD. However I also want to get the group where the user belongs. but I don't know how. Can anyone help me?
here is the authentication in AD I copied...
ASP Syntax (Toggle Plain Text)
<%@ Language="VBScript" %> <% Option Explicit Response.Buffer = True '// 1. Form Validation Dim Submit, UserName, Password, Domain, Result, Message Submit = "Authenticate" 'Assume Failure Application("Error")= true If Submit = "Authenticate" Then response.write("autenthication <br>") 'Get the input from your HTML form UserName = Request.Form("UserName") Password = Request.Form("Password") Domain = Application("Domain") Session("usern") = UserName 'Call the AuthenticateUser() function to do the verification process Result = AuthenticateUser(UserName, Password, Domain) If Result Then 'If user exist, then redirect to success page 'login success Application("Error")= false Response.Redirect ("success.asp") Else 'If user don't exist, redirect to error page 'login failed Application("Error")= true Response.Redirect ("../") End If End If '// 2. Authenticate Function Function AuthenticateUser(UserName, Password, Domain) Dim strUser, strPassword, strQuery, oConn, cmd, oRS 'Assume Failure AuthenticateUser = false strQuery = "SELECT cn FROM 'LDAP://" & Domain & "' WHERE objectClass='*'" Set oConn = server.CreateObject("ADODB.Connection") oConn.Provider = "ADsDSOOBJECT" oConn.Properties("User ID") = UserName oConn.Properties("Password") = Password oConn.Properties("Groups") = "SALES" oConn.Properties("Encrypt Password") = true oConn.open "ADProvider", strUser, strPassword Set cmd = server.CreateObject("ADODB.Command") Set cmd.ActiveConnection = oConn cmd.CommandText = strQuery On Error Resume Next Set oRS = cmd.Execute If oRS.bof OR oRS.eof Then AuthenticateUser = False Else AuthenticateUser = True End if Set oRS = Nothing Set oConn = nothing End Function '############### CHECKER ######### response.write(myString) %>
![]() |
Similar Threads
- Active Directory Users and Computers (Windows Servers and IIS)
- list all security groups in active directory (VB.NET)
- Adding user and mailbox in Active Directory (Python)
- Active Directory 2003 Script (Python)
- how to sort out 'active directory cannot be found in cache' error (Visual Basic 4 / 5 / 6)
- Integrating with Active Directory (OS X)
- Active Directory (Windows NT / 2000 / XP)
Other Threads in the ASP Forum
- Previous Thread: ASP Error
- Next Thread: CDOSYS Error
| Thread Tools | Search this Thread |
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection connection database databaseconnection dreamweaver excel fso iis msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption single specfic sqlserver sqlserverconnection windows7





