Check if isuer is a member of group and go to ok page (adsi ldap)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sal21
    New Member
    • Jun 2006
    • 27

    Check if isuer is a member of group and go to ok page (adsi ldap)

    In asp classic no NET!

    Usign LDAP or ADSI

    i know:
    my server is server NT
    name of domain=dip
    name of group=my_group
    name of user=my_user

    I need a asp page with a input text box named "insert your userrname here"
    and a post button "verify"

    After pressign button, validate the user name if is present in the group "my_group", if YES goto my_ok_page.asp, if NO write an attention message in home page.
  • CroCrew
    Recognized Expert Contributor
    • Jan 2008
    • 564

    #2
    Hello sal21,

    I would check if the status of the user is enabled rather then checking if the user exists. A user could exist and be disabled for reasons that we might not know of. Checking for the user not being disabled gives us the assurance that ‘yes’ he or she is a user on our network and at this time we allow him or her access to the network.

    PageOne.asp:
    [code=asp]
    <html>
    <head>
    <title>Page One</title>
    </head>
    <body>
    <%If (Request("Error ")) Then%>
    Not a user!<br>
    <%End If%>
    <form method="post" action="PageTwo .asp" name="xForm" id="xForm">
    Insert your userrname here: <input type="text" name="xName"> <input type="submit" value="Verify">
    </form>
    </body>
    </html>
    [/code]

    PageTwo.asp:
    [code=asp]
    <%
    YourOrganizatio nalUnit = "Sales"
    YourDomain = "dip"
    YourDomainType = "com"
    Set objUser = GetObject("LDAP ://cn=" & Request.Form("x Name") & ",ou=" & YourOrganizatio nalUnit & ",dc=" & YourDomain & ",dc=" & YourDomainType)

    If (objUser.Accoun tDisabled) Then
    response.redire ct("PageOne.asp ?Error=true")
    Else
    response.redire ct("my_ok_page. asp")
    End If
    %>
    [/code]

    More information on LDAP binding can be found here: http://www.rlmueller.net/LDAP_Binding.htm

    Hope that helps~

    Comment

    • sal21
      New Member
      • Jun 2006
      • 27

      #3
      Originally posted by CroCrew
      Hello sal21,

      I would check if the status of the user is enabled rather then checking if the user exists. A user could exist and be disabled for reasons that we might not know of. Checking for the user not being disabled gives us the assurance that ‘yes’ he or she is a user on our network and at this time we allow him or her access to the network.

      PageOne.asp:
      [code=asp]
      <html>
      <head>
      <title>Page One</title>
      </head>
      <body>
      <%If (Request("Error ")) Then%>
      Not a user!<br>
      <%End If%>
      <form method="post" action="PageTwo .asp" name="xForm" id="xForm">
      Insert your userrname here: <input type="text" name="xName"> <input type="submit" value="Verify">
      </form>
      </body>
      </html>
      [/code]

      PageTwo.asp:
      [code=asp]
      <%
      YourOrganizatio nalUnit = "Sales"
      YourDomain = "dip"
      YourDomainType = "com"
      Set objUser = GetObject("LDAP ://cn=" & Request.Form("x Name") & ",ou=" & YourOrganizatio nalUnit & ",dc=" & YourDomain & ",dc=" & YourDomainType)

      If (objUser.Accoun tDisabled) Then
      response.redire ct("PageOne.asp ?Error=true")
      Else
      response.redire ct("my_ok_page. asp")
      End If
      %>
      [/code]

      More information on LDAP binding can be found here: http://www.rlmueller.net/LDAP_Binding.htm

      Hope that helps~
      Very good explain...
      But my domain not have YourDomainType the name of demain is simple DIP is in intranet Winnt, time to modify your scrpt?
      Tks.

      Comment

      Working...