Solved

How to login based on Active Directory Credentials

Posted on 2008-06-12
3
495 Views
Last Modified: 2010-08-05
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!!!!!
0
Comment
Question by:Devario Johnson
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
squillman earned 500 total points
ID: 21773830
Try something like this:

boolLoggedIn=false
strDomain = "MYDOMAIN"
strUser="user1"
strUserDomain = strDomain & "\" & strUser
strPassword="password"
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
Else
     boolLoggedIn = True
End If
0
 
LVL 5

Author Comment

by:Devario Johnson
ID: 21775254
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!
0
 
LVL 5

Author Closing Comment

by:Devario Johnson
ID: 31466737
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
0

Join & Write a Comment

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Mapping Drives using Group policy preferences Are you still using old scripts to map your network drives if so this article will show you how to get away for old scripts and move toward Group Policy Preference for mapping them. First things f…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now