Hey All,
I have scoured the site and googled until my head hurt but still stuck. Basically I am trying to get this ASP code to work in order to get the current windows username and check their domain group membership and based on which group it will redirect them to a proper page or redirect to a custome denial page. Here is what I have so far in my ASP page. Do I have things in wrong locations or is it even possible. BTW - IIS on 2000 member server with basic authentication set for now and MDAC 2.8 on each side.
I currently get a failure on the bolded line
<%@ language="VBSCRIPT" %>
<%
MemberGodGroup = IsAMember("Domain-Admins")
If (MemberGodGroup ) Then
response.write("hello")
End If
Function IsAMember(strGroup)
Dim strUserID ' The User ID in context
Dim strPath ' The namespace path (where to get information)
Dim objUserInfo ' Where the user information is kept
Dim objGroup ' A collection containing group users
Dim blnInGroup ' Is this person a member of the group?
strUserID = ucase(Request.ServerVariables("AUTH_USER"))
strUserID = Mid(strUserID,(instr(1,strUserID,"\")+1),len(strUserID))
strPath = "WinNT://mydomain/" & strUserID & ",user"
'Get the information.
Set objUserInfo = GetObject(strPath)
IsAMember = False
'Redefine the query to get all the members of the Need2Know group
strPath = "WinNT://mydomain/" & strGroup & ",group"
'Ask NT to give us all the members of the group in question
Set objGroup = GetObject(strPath)
'Iterate through the group members
for each objUserInfo in objGroup.Members
' Determine if the page requestor is a member of the provider group
if ucase(objUserInfo.Name) = strUserID Then
' Yes, this requestor is...
IsAMember = True
' Exit this loop when found
Exit For
end If
Next
End Function
%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>testing for group membership</title>
</head>
<body>
<!-- Insert HTML here -->
</body>
</html>
Thanks in advanced
Clay
I have scoured the site and googled until my head hurt but still stuck. Basically I am trying to get this ASP code to work in order to get the current windows username and check their domain group membership and based on which group it will redirect them to a proper page or redirect to a custome denial page. Here is what I have so far in my ASP page. Do I have things in wrong locations or is it even possible. BTW - IIS on 2000 member server with basic authentication set for now and MDAC 2.8 on each side.
I currently get a failure on the bolded line
<%@ language="VBSCRIPT" %>
<%
MemberGodGroup = IsAMember("Domain-Admins")
If (MemberGodGroup ) Then
response.write("hello")
End If
Function IsAMember(strGroup)
Dim strUserID ' The User ID in context
Dim strPath ' The namespace path (where to get information)
Dim objUserInfo ' Where the user information is kept
Dim objGroup ' A collection containing group users
Dim blnInGroup ' Is this person a member of the group?
strUserID = ucase(Request.ServerVariables("AUTH_USER"))
strUserID = Mid(strUserID,(instr(1,strUserID,"\")+1),len(strUserID))
strPath = "WinNT://mydomain/" & strUserID & ",user"
'Get the information.
Set objUserInfo = GetObject(strPath)
IsAMember = False
'Redefine the query to get all the members of the Need2Know group
strPath = "WinNT://mydomain/" & strGroup & ",group"
'Ask NT to give us all the members of the group in question
Set objGroup = GetObject(strPath)
'Iterate through the group members
for each objUserInfo in objGroup.Members
' Determine if the page requestor is a member of the provider group
if ucase(objUserInfo.Name) = strUserID Then
' Yes, this requestor is...
IsAMember = True
' Exit this loop when found
Exit For
end If
Next
End Function
%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>testing for group membership</title>
</head>
<body>
<!-- Insert HTML here -->
</body>
</html>
Thanks in advanced
Clay