By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,926 Members | 1,809 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,926 IT Pros & Developers. It's quick & easy.

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

P: 18
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.
Feb 11 '08 #1
Share this Question
Share on Google+
2 Replies


CroCrew
Expert 100+
P: 563
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:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <title>Page One</title>
  4.     </head>
  5.     <body>
  6.         <%If (Request("Error")) Then%>
  7.             Not a user!<br>
  8.         <%End If%>
  9.         <form method="post" action="PageTwo.asp" name="xForm" id="xForm">
  10.             Insert your userrname here: <input type="text" name="xName"> <input type="submit" value="Verify">
  11.         </form>
  12.     </body>
  13. </html>
  14.  
PageTwo.asp:
Expand|Select|Wrap|Line Numbers
  1. <%
  2.     YourOrganizationalUnit = "Sales"
  3.     YourDomain = "dip"
  4.     YourDomainType = "com"
  5.     Set objUser = GetObject("LDAP://cn=" & Request.Form("xName") & ",ou=" & YourOrganizationalUnit & ",dc=" & YourDomain & ",dc=" & YourDomainType)
  6.  
  7.     If (objUser.AccountDisabled) Then
  8.         response.redirect("PageOne.asp?Error=true")
  9.     Else
  10.         response.redirect("my_ok_page.asp")
  11.     End If
  12. %>
  13.  
More information on LDAP binding can be found here: http://www.rlmueller.net/LDAP_Binding.htm

Hope that helps~
Feb 11 '08 #2

P: 18
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:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <title>Page One</title>
  4.     </head>
  5.     <body>
  6.         <%If (Request("Error")) Then%>
  7.             Not a user!<br>
  8.         <%End If%>
  9.         <form method="post" action="PageTwo.asp" name="xForm" id="xForm">
  10.             Insert your userrname here: <input type="text" name="xName"> <input type="submit" value="Verify">
  11.         </form>
  12.     </body>
  13. </html>
  14.  
PageTwo.asp:
Expand|Select|Wrap|Line Numbers
  1. <%
  2.     YourOrganizationalUnit = "Sales"
  3.     YourDomain = "dip"
  4.     YourDomainType = "com"
  5.     Set objUser = GetObject("LDAP://cn=" & Request.Form("xName") & ",ou=" & YourOrganizationalUnit & ",dc=" & YourDomain & ",dc=" & YourDomainType)
  6.  
  7.     If (objUser.AccountDisabled) Then
  8.         response.redirect("PageOne.asp?Error=true")
  9.     Else
  10.         response.redirect("my_ok_page.asp")
  11.     End If
  12. %>
  13.  
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.
Feb 12 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.