|
<%
'''''''''''''''''''''''''''''''''''''''''''''''''
'
' ADSI User Authentication Script
' Author: Faisal Haroon
' Orgnization: Aga Khan University, ISD
' File name: login.asp
' Create Date: 10th April 2002
' Platform: ASP 2.0/3.0
'
'''''''''''''''''''''''''''''''''''''''''''''''''
Dim objLogon
' create an object for impersonating IIS to use a valid domain user instead of anonymous user IUSR_machinename
Set objLogon = Server.CreateObject("LoginAdmin.ImpersonateUser")
' any domain user who has rights to access active directory
objLogon.Logon "user id", "password", "domain name"
' check here for a form post ...
if request("GETUSER") = "" Then
' write out the form
With Response
.write "<p><h3>Active Directory Login Form</h3></p><br>"
.write "<FORM ACTION=login.asp METHOD=POST>"
.write "<INPUT TYPE=TEXT NAME=oUSer>ENTER USER NAME TO CHECK<BR>"
.write "<INPUT TYPE=PASSWORD NAME=oPassword>ENTER USER PASSWORD<BR>"
.Write "<INPUT TYPE =SUBMIT NAME=GETUSER VALUE=CHECK>"
.write "</FORM>"
end with
else
' Form was autopostback, grab the form variables ...
strUser = Request("oUser")
strPassword = Request("oPassword")
Set oUser = Server.CreateObject("prjLogin.clsDomainLogin")
' BindObject has two parameters userid and password
iResult = oUser.BindObject(strUser, strPassword, "AKU.EDU")
'on error resume next
' Set reference to the ADSI interface to NT User Manager ...
Response.write "<p><h4>Output</h4></p>"
if iResult = 1 then
Response.write "<br>Login success!"
' Whatever you want to process here
else
Response.write "<br>BAD PASSWORD!"
' Whatever you want to process here
end if
set oUser = Nothing
end if
objLogon.Logoff
Set objLogon = Nothing
%>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Faisal is Senior Team Lead at The Shams Group, Karachi. He has 10+ years of experience in the field of software/ web development and infrastructure management.
He has worked on various tools and platform which includes VB, ASP, ASP.NET, Javascript, COM/COM+, SQL Server, Informix, Active Directory, UNIX/Solaris, WSH, Windows NT/ 2000 servers, RADIUS, SMTP, POP, IMAP etc.
He likes to watch movies, hangs out with friends and loves to make new friends.