Classic ASP (VBScript), 2008 R2, error using AD to

2019-06-14 07:20发布

问题:

I have moved a web site from Win2003 x32 to Win2008R2 x64. It works fine on the old server. The web site uses active directory to authenticate. I get this error on 2008: -2147023584 : A specified logon session does not exist. It may already have been terminated. I have tried switching to classic mode, etc. with no change. It does execute VBScript code (otherwise I wouldn't get the error).

Here is the code:

Function AuthenticateUser(UserName, Password)

    On Error Resume Next

    Dim oADsNamespace, oADsObject
    Dim strADsNamespace, strADsPath

    strADsPath = "WinNT://ibcschools.edu"
    strADsNamespace = left(strADsPath, instr(strADsPath, ":"))

    Set oADsObject = GetObject(strADsPath)
    Set oADsNamespace = GetObject(strADsNamespace)
    Set oADsObject = oADsNamespace.OpenDSObject(strADsPath, UserName, Password, 0)
    Response.Write(Err.Number & " : " & Err.Description & "<br />")
    If Err.Number = 0 Then

        Set oADsNamespace = Nothing
        Set oADsObject = Nothing
        Set strADsNamespace = Nothing
        Set strADsPath = Nothing

        AuthenticateUser = True

    Else

        Set oADsNamespace = Nothing
        Set oADsObject = Nothing
        Set strADsNamespace = Nothing
        Set strADsPath = Nothing

        AuthenticateUser = False

    End If

End Function

Any help would be appreciated. Thanks.

回答1:

Your problem seems to be related to using WinNT provider with OpenDSObject.

Things you could try:

  1. Replace WinNT with LDAP provider.
  2. Try running your standalone VBS file under IIS/ApplicationPool user privileges.


回答2:

Okay, so I got it working. Before it worked without the domain name, but now requires it. I think it has something to do with the app pool logging in on the old server versus this one. I am going to work on it a little more. I don't want to change all the sites.