Iam working on an intranet page. what i want to do is query active directory and check that the user is a member of a specific active directory group. the thing is i'm unsure how to do that.
At the moment i know how to get the logged in username of the user using the function below. but i'm unsure how to then say 'for this username is that person in group a'.
if you get what i mean.
Any help would be gratefully received.
Code:Private Function GetUserName() Dim sNTUserName DIm sProcessedNTUserName sNTUserName = Request.ServerVariables("AUTH_USER") ''' need to change the user name from backslahes to forward slashes for ADSI lookup sProcessedNTUserName = Replace(sNTUserName, "\", "/") ''' now get the full name from the active directory Dim oUser On Error Resume Next Set oUser = GetObject("WinNT://" & sProcessedNTUserName & ",user") If Err.Number = 0 Then GetUserName = oUser.FullName Else Dim lErrNumber lErrNumber = Err.Number On Error Goto 0 Err.Raise lErrNumber, "UserRoutines.asp", "Unable to get your user account information from the active directory" End If End Function




Reply With Quote