• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 511
  • Last Modified:

How to login based on Active Directory Credentials

Hi, I would like to do a mockup of how to login to an Classic ASP page using Active Directory Credentials.  I have already connected to the AD using LDAP and was able to query all of the groups and it;s members.  however now I would like to take it a step further and actually use an HTML form that posts an action to a classic asp form action page that queries the AD to see if the user / pass is correct and then allow them to progress to the next screen if this is true....

i know this may be simple.... but my way was kinda bloated and id like an EXPERT to simplify it for me without all the excess :)  Thanks!!!!!
Devario Johnson
Devario Johnson
  • 2
1 Solution
Try something like this:

strDomain = "MYDOMAIN"
strUserDomain = strDomain & "\" & strUser
ADS_SECURE_AUTHENTICATION=1 'this is a const, not a flag

Set objNameSpace= GetObject("WinNT:")    
Set objDSObject = objNameSpace.OpenDSObject("WinNT://" & strDomain, strUserDomain, strPassword, ADS_SECURE_AUTHENTICATION)
If Err.Number <> 0 Then
    boolLoggedIn = False
     boolLoggedIn = True
End If
Devario JohnsonSoftware EngineerAuthor Commented:
That is a very clean and precise code...I dont even see Ldap anywhere...thanks for your assitance!!!!!

I will try this when I get in to work tomorrow!
Devario JohnsonSoftware EngineerAuthor Commented:
Good job...the only thing missing from this example are variable declarations...but you should know that by looking at it.  just a FYI to novice programmers who may be researching this thread
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now