简体   繁体   English

经典ASP(VBScript),2008 R2,使用AD进行身份验证时出错

[英]Classic ASP (VBScript), 2008 R2, error using AD to authenticate

I have moved a web site from Win2003 x32 to Win2008R2 x64. 我已经将网站从Win2003 x32移到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. 我在2008年收到此错误:-2147023584:指定的登录会话不存在。 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). 它确实执行VBScript代码(否则我不会收到错误)。

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. 谢谢。

Your problem seems to be related to using WinNT provider with OpenDSObject . 您的问题似乎与将WinNT提供程序与OpenDSObject一起使用有关。

Things you could try: 您可以尝试的事情:

  1. Replace WinNT with LDAP provider. LDAP提供程序替换WinNT
  2. Try running your standalone VBS file under IIS/ApplicationPool user privileges. 尝试以IIS / ApplicationPool用户权限运行独立的VBS文件。

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. 我不想更改所有站点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM