Check if user is in Group (ldap adsi WIN NT)

I know:
Name of server is DIP
Name of Group is Farm_group

I need a page with code in ASP classic NO NET!...
create a page in ASP with a box and button.
In the box the user insert the username and after pressing the button controll if the user is in Group on AD Winnt server.

If user is in group goto OK_page.asp if thje user not is in group appera message yopu noet are in "Farm_Group , access denied"

Possible?
sal21Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ddrudikCommented:
See if this example project fits what you need:
http://www.codeproject.com/KB/asp/webactivedirlogin.aspx
0
sal21Author Commented:
Hi ddrudik, tks for link...
But i want to check user in specific group not username and password in winnt ad....
0
ddrudikCommented:
I believe it will require an ActiveX module to accomplish this with Classic ASP, this one seems to fit your requirements:
http://easterndigitalsoftware.com/justldap/justldap.htm

They have a trial download you might want to try out to verify it works for you.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

sal21Author Commented:
Peraphs solved 85% with the code here...

1) but ho to read via code the name of user logged and assing to the var  sUserName...instead  "oi24683"
?????

2) ho to show message in asp page if, after the select case not have success
?????

<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Nuova pagina 1</title>
</head>

<body>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'http://p2p.wrox.com/topic.asp?TOPIC_ID=7848

Set oNetwork = CreateObject("WScript.Network")

sDomain = "DIP"
sUserName = "OI24683"

'sUserName = oNetwork.UserName
'sUserName = request.servervariables("AUTH_USER")

Set oUser = GetObject("WinNT://" & sDomain & "/" & sUserName & ",user")

For Each oGroup In oUser.Groups
Select Case(oGroup.Name)
    Case "InpdapNAXX"
    'Response.write("InpdapNAXX")
    Response.Redirect("./default.html")
    Case "Group B"
    'response.write("Yay")
    Response.Redirect("A.asp")
    Case "Group C"
    response.Redirect("Z.asp")
    Case "Group D"
    Response.redirect("Y.asp")
End Select
Next
%>

</body>

</html>
</form>
0
jitgangulyCommented:
1.For request.servervariables("AUTH_USER")  to work try unticking "Integrated Windows Authentication" in the same area where you untick anynomous access.

MS seems to think that this is the only solution:
SYMPTOMS
Accessing the Request.ServerVariables("LOGON_USER") variable from Active Server Pages (ASP) returns an empty string.

CAUSE
The LOGON_USER variable is not populated if the ASP page is accessed using Allow Anonymous security.

In order for the LOGON_USER variable to be populated, the user must be authenticated using either Basic or NT Challenge/Response security.

2. USe
Case else
response.write "no redirection"
response.end
0
sal21Author Commented:
hum........

Now i think.
Is possible to adjust the script in this mode:
insert 2 box in asp page:
username
password

authetnticate the user in domain, if the user with user name and password is authenticate use the filed of username to fill the var susername var....

Wath you think about?

naturally use attention message if user and password not are matched...
0
jitgangulyCommented:
First let me know if the suggestions are working
0
sal21Author Commented:
ok ....
But understand my suggestion?
(my english is a napolitan english)
:-)
0
jitgangulyCommented:
:-)
Ok. Lets try to fix your current problems and then we can always enhance it
0
sal21Author Commented:
nice!!!
Tks for patience.
Pizza are ready for you.
0
jitgangulyCommented:
what about hot wings ?
0
sal21Author Commented:
just found tath and it work on my domain:
<form method="post">  
      <table align="center" border="0" cellpadding="5" cellspacing="0" width="400">
          <tr>
            <td align="right">Domain:</td>
            <td><input type="text" size="30" name="domain" value="" /></td>
          </tr>
          <tr>
            <td align="right">User:</td>
            <td><input type="text" size="30" name="username" value="" /></td>
          </tr>
          <tr>
            <td align="right">Password:</td>
            <td><input type="password" size="30" name="password" value="" /></td>
          </tr>
          <tr>
            <td align="center" colspan="2"><input type="submit" value="Login" name="cmdLogin" /></td>
          </tr>
      </table>
</form>

<%
On Error Resume Next
If Request.Form <> "" Then
      strUserName = Request.Form("username")
      strPassword = Request.Form("password")
      strDomain = Request.Form("domain")
      strADsPath = "WinNT://" & strDomain
      Set oADsObject = GetObject(strADsPath)
      Set oADsNamespace = GetObject("WinNT:")
      Set oADsObject = oADsNamespace.OpenDSObject(strADsPath, strDomain & "\" & strUserName, strPassword, 0)
      If Err.Number = 0 Then              
        Response.Write "<h2>Authenticated</h2>"        
      Else
        Response.Write "<h2>Login Failed</h2>"
      End If
End If
%>
0
sal21Author Commented:
Not uset the box domain i want to isert to the defaul in script....
0
jitgangulyCommented:
>>Not uset the box domain i want to isert to the defaul in script....

Sorry didn't understand your 'napolitan english'.Could u explain more
0
sal21Author Commented:
Hi jitganguly not consider last note: Not uset the box domain i want to isert to the defaul in script....
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.