ASP Login Page for Active directory Authentication
Hi,
Someone pls help me with following ASP login page issue, I been trying for last 4-5 weeks but no luck; I don't have much knowledge on ASP.
Currently I am working on ASP login page which
allows user to enter their domain Username / password and once submitted it will authenticate against Active Directory Services and once authenticated it will redirect user to intranet site.
AD Server: Server1
Domain name: mydomain.local
All users are located under root USERS container and don't have any OU.
With Following ASP code,have hardCoded user
credential for testing,
Untitled Document
<%
userName = "asptest"
password = "test1234"
Dim ldapServer, dso, lobjUser, password
Dim server
Server="server1"
On Error resume next
' Construct the FQDN
ldapServer = "ldap://Server1:389/DC=mydomain,DC=local"
ldapServer = replace(ldapServer, "#username#", userName)
' Connect to the LDAP Directory
Set dso = GetObject("LDAP:")
userName = Mid(ldapserver, InStr(8, ldapserver, "/") + 1)
'Validate the User Name and Password
Set lobjUser = dso.OpenDSObject(ldapserver, userName, password, ADS_SECURE_AUTHENTICATION)
Response.Write "user: " + userName + "
password: " + password
If Err.number <> 0 Then
Response.Write "
Authentication Failed!"
Set lobjUser = nothing
Set dso = nothing
Else
Response.Write "
Successfully Authenticated!"
end if
%>