Question

Locked

ASP Login Page for Active directory Authentication

By omasp ·
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,

<html>
<head>
<title>Untitled Document</title>
</head>

<body>
<%
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 + " <br/> password: " + password

If Err.number <> 0 Then
Response.Write "<br/><font color=red><STRONG>Authentication Failed!</STRONG></font>"
Set lobjUser = nothing
Set dso = nothing
Else
Response.Write "<br/><font color=green><STRONG>Successfully Authenticated!</STRONG></font>"
end if

%>
</body>
</html>

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Networks Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums