This topic is locked

Active Directory Login

9/30/2011 2:04:14 AM
ASPRunnerPro General questions
A
akira_nagasaki author

Hi I'll try to put this code at login page (before process) but it's getting error.
Anybody here have an idea how to connect to LDAP or login using windows active directory instead of database?
when i run this code at "standalone asp single page" it was work, it will getting error when i paste into before process login page.
Please help

dim submit

dim UserName

dim Password
UserName = ""

Password = ""

Domain = "example.com"
submit = request.form("submit")
if submit = "Authenticate" then

UserName = request.form("UserName")

Password = request.form("Password")

Domain = request.form("Domain")

result = AuthenticateUser(UserName, Password, Domain)

if result then

response.write "<h3>Authentication Succeeded!</h3>"

else

response.write "<h3>Authentication Failed!</h3>"

end if

end if
response.write "<hr><form method=post>"

response.write "<table>"

response.write "<tr>"

response.write "<td><b>Username:&nbsp;</b></td><td><input type=""text""name=""UserName"" value=""" & UserName & """ size=""30"">
<small>Enter as""mirvalve\UserName""</small></td>"

response.write "</tr>"

response.write "<tr>"

response.write "<td><b>Password:&nbsp;</b></td><td><input type=""password"" name=""Password"" value=""" & Password & """ size=""30""></td>"

response.write "</tr>"

response.write "<tr>"

response.write "<td><b></b></td><td><input type=""hidden"" name=""Domain"" value=""" & Domain & """ size=""30"">
<small>
</small></td>"

response.write "</tr>"

response.write "<tr>"

response.write "<td>&nbsp;</td><td><input name=""submit"" type=""submit"" value=""Authenticate""></td>"

response.write "</tr>"

response.write "</table>"

response.write "</form>"

response.end
function AuthenticateUser(UserName, Password, Domain)

dim strUser

' assume failure

AuthenticateUser = false
strUser = UserName

strPassword = Password
strQuery = "SELECT cn FROM 'LDAP://" & Domain & "' WHERE objectClass='*' "

set oConn = server.CreateObject("ADODB.Connection")

oConn.Provider = "ADsDSOOBJECT"

oConn.Properties("User ID") = strUser

oConn.Properties("Password") = strPassword

oConn.Properties("Encrypt Password") = true

oConn.open "DS Query", strUser, strPassword
set cmd = server.CreateObject("ADODB.Command")

set cmd.ActiveConnection = oConn

cmd.CommandText = strQuery

on error resume next

set oRS = cmd.Execute

if oRS.bof or oRS.eof then

AuthenticateUser = false

else

AuthenticateUser = true

end if

set oRS = nothing

set oConn = nothing
end function
Sergey Kornilov admin 9/30/2011

Hard to tell what might be wrong without seeing the actual application.
You can post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

A
akira_nagasaki author 10/3/2011



Hard to tell what might be wrong without seeing the actual application.
You can post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.


i already uploaded to the demo account. when i click on my view account it say
Account is awaiting verification. We have sent you the verification instructions to your email address.
but i still not received any email. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=61207&image=1&table=forumreplies' class='bbc_emoticon' alt=':ph34r:' />

Sergey Kornilov admin 10/4/2011

You need to contact support directly so we can find your application on Demo Account and assist you.