Vbscript 经典asp中的LDAP认证

Vbscript 经典asp中的LDAP认证,vbscript,asp-classic,ldap,Vbscript,Asp Classic,Ldap,我有我的ASP站点的LDAP身份验证。代码在Windows2003服务器上运行良好。但是,我们需要将应用程序迁移到Windows 2012 R2服务器。不幸的是,同样的“服务器未运行”错误出现 下面是我的代码。请告知同样的情况 Function AuthUser(strFSUID, strPwd) Const ADS_FAST_BIND_SSL = 34 'forces fast binding and SSL connection Const strADSPath =

我有我的ASP站点的LDAP身份验证。代码在Windows2003服务器上运行良好。但是,我们需要将应用程序迁移到Windows 2012 R2服务器。不幸的是,同样的“服务器未运行”错误出现

下面是我的代码。请告知同样的情况

Function AuthUser(strFSUID, strPwd)

    Const ADS_FAST_BIND_SSL = 34 'forces fast binding and SSL connection
    Const strADSPath =
    "LDAP://mdsoti.fsu.edu:636/ou=People,dc=fsu,dc=edu" 'full path to LDAP server
    Const strProxyUser = "proxy-user" 'proxy username For establishing initial connection to LDAP
    Const strProxyPass = "proxy-pass" 'proxy password For establishing initial connection To LDAP

    Dim conADODB 'LDAP admin connection
    Dim comADODB 'User DB connection
    Dim rsLDAP 'recordset to hold user information
    Dim dsoLDAP 'LDAP system object
    Dim conUser 'LDAP connection to validate username and password
    Dim strPath 'users FQDN path
    Dim strUser 'users dn stripped from ADsPath
    Dim blnAuthenticated 'has user been authenticated: 0 = no, -1 = yes

    On Error Resume Next
    blnAuthenticated = False

    'Create our admin connection for retrieving user DN
    Set conADODB = CreateObject("ADODB.Connection")
    conADODB.Provider = "ADsDSOObject"
    conADODB.Properties("user ID") = "cn=" & strProxyUser & ",ou=proxy-users,dc=fsu,dc=edu"
    conADODB.Properties("Password") = strProxyPass
    conADODB.Properties("ADSI Flag") = ADS_FAST_BIND_SSL

    conADODB.Open "ADSI"

    'next we get the users dn
    Set comADODB = CreateObject("ADODB.Command")
    Set comADODB.ActiveConnection = conADODB
    comADODB.CommandText = "<" & strADSPath & ">;(cn=" & strFSUID & ");Adspath,cn,;subtree"
    Set rsLDAP = comADODB.Execute

    'finally, we validate the actual username and password
    While Not (rsLDAP.EOF)
        strPath = rsLDAP.fields("ADsPath")
        wscript.echo strPath

        'strip out user dn from ADsPath
        strUser = InStrRev(strPath, "/")
        strUser = Mid(strPath, strUser + 1)
        wscript.echo strUser

        'open connection to authenticate users FSUID and password
        Set dsoLDAP = GetObject("LDAP:")
        Set conUser = dsoLDAP.OpenDSObject(strADSPath, strUser, strPwd, ADS_FAST_BIND_SSL)

        'see if the user's password worked. if not print error message 
        If Err.Number <> 0 Then
           blnAuthenticated = False
        Else
           blnAuthenticated = True
        End If

        v = rsLDAP.fields("cn")
        wscript.echo v(0)

        rsLDAP.MoveNext
    Wend

    AuthUser = blnAuthenticated
End Function
函数AuthUser(strFSUID,strPwd)
Const ADS_FAST_BIND_SSL=34'强制快速绑定和SSL连接
斯特拉斯帕斯常数=
“LDAP://mdsoti.fsu.edu:636/ou=People,dc=fsu,dc=edu”'LDAP服务器的完整路径
Const strproxy user=“proxy user””用于建立到LDAP的初始连接的代理用户名
Const strproxy pass=“proxy pass”'用于建立到LDAP的初始连接的代理密码
Dim conADODB的LDAP管理连接
Dim comADODB的用户数据库连接
用于保存用户信息的Dim rsLDAP记录集
Dim dsoLDAP的LDAP系统对象
用于验证用户名和密码的用户LDAP连接
Dim strPath的用户FQDN路径
Dim strUser用户dn从ADsPath剥离
Dim blnAuthenticated'用户已通过身份验证:0=否,-1=是
出错时继续下一步
blnAuthenticated=False
'创建用于检索用户DN的管理员连接
设置conADODB=CreateObject(“ADODB.Connection”)
conADODB.Provider=“ADsDSOObject”
conADODB.Properties(“用户ID”)=“cn=“&strproxy用户&”,ou=代理用户,dc=fsu,dc=edu”
conADODB.Properties(“密码”)=strProxy密码
conADODB.Properties(“ADSI标志”)=ADS\u FAST\u BIND\u SSL
conADODB.打开“ADSI”
'接下来,我们将获得用户dn
设置comADODB=CreateObject(“ADODB.Command”)
设置comADODB.ActiveConnection=conADODB
comADODB.CommandText=“;(cn=“&strFSUID&”;Adspath,cn,;子树”
设置rsLDAP=comADODB.Execute
'最后,我们验证实际的用户名和密码
而不是(rsLDAP.EOF)
strPath=rsLDAP.fields(“ADsPath”)
wscript.echo strPath
'从ADsPath中删除用户dn
strUser=InStrRev(strPath,“/”)
strUser=Mid(strPath,strUser+1)
wscript.echo strUser
'打开连接以验证用户FSUID和密码
设置dsoLDAP=GetObject(“LDAP:”)
Set conUser=dsoLDAP.OpenDSObject(straspath、strUser、strPwd、ADS\u FAST\u BIND\u SSL)
'查看用户的密码是否有效。如果没有,打印错误消息
如果错误号为0,则
blnAuthenticated=False
其他的
blnAuthenticated=True
如果结束
v=rsLDAP.fields(“cn”)
wscript.echo v(0)
rsLDAP.MoveNext
温德
AuthUser=blnAuthenticated
端函数
执行“Set rsLDAP=comADODB.Execute”时出错


非常感谢

在Windows 2012 server命令行上尝试以下代码?telnet mdsoti.fsu.edu 636可以通过telnet进行连接。。。我认为SSl证书存在问题