首页 > 解决方案 > 从工作组 IIS 安装向 AD 进行身份验证

问题描述

我正在使用经典的 ASP(我知道我应该继续使用 ASP.NET)和工作组 IIS 安装。我可以让它对 AD 进行身份验证吗?因此,到目前为止,它只是无法连接到 AD。

它在我的已加入域的桌面上运行,没有任何麻烦,但相同的代码在工作组机器上不起作用。

Session( "signon_domain" ) = UCase( strSignOnDomain )
Session( "signon_userid" ) = LCase( strSignOnUserID )

' Set the AD path to connect to
strADsPath = "WinNT://" & strSignOnDomain

' Bind to the AD path
Set objADsPath = GetObject( strADsPath )

' Get the namespace
strADsNamespace = "WinNT:"

' Bind to the namespace
Set objADsNamespace = GetObject( strADsNamespace )

' Turn on error handling
On Error Resume Next

' Connect to AD with the provided credentials
Set objADsAuthenticate = objADsNamespace.OpenDSObject( strADsPath, strSignOnDomain & "\" & strSignOnUserID, strSignOnPassword, 0 )

' Check for any errors
If Err.Number <> 0 Then
    ' Specify the error to display
    strMessage = "User ID or password or domain incorrect."
    Session( "signon" ) = ""
Else
    Session( "signon" ) = "successful"
End If

' Turn off error handling
On Error Goto 0

' Clear variables
Set objADsAuthenticate = Nothing
Set objADsNamespace = Nothing
Set objADsPath = Nothing
strADsNamespace = Empty
strADsPath = Empty

期待来自 AD 的响应,但它根本没有连接到 AD。

标签: iisvbscriptasp-classic

解决方案


推荐阅读