0

我有两个函数列出了 ASP.NET 应用程序上的用户 NT 组

Private Function getUserGroups() As Boolean
        ' collect the user domain and identity
        Dim arr As String() = System.Web.HttpContext.Current.Request.LogonUserIdentity.Name.Split("\"c)

        Dim al As New ArrayList()
        al = GetGroups()

        For Each s As String In al
            testt.InnerHtml += s & "<br />"   
        Next

        Return auth
    End Function

    Public Function GetGroups() As ArrayList
        Dim groups As New ArrayList()
        For Each group As System.Security.Principal.IdentityReference In System.Web.HttpContext.Current.Request.LogonUserIdentity.Groups
            groups.Add(group.Translate(GetType(System.Security.Principal.NTAccount)).ToString())
        Next
        Return groups
    End Function

在本地运行(开发模式)时,我得到的列表比在远程服务器上运行时长得多:

Local:

DOMAIN_EX\Domain Users
Everyone
BUILTIN\Administrators
BUILTIN\Users
NT AUTHORITY\INTERACTIVE
CONSOLE LOGON
NT AUTHORITY\Authenticated Users
NT AUTHORITY\This Organization
LOCAL
DOMAIN_EX\Eg12w
DOMAIN_EX\Eg12
DOMAIN_EX\SEC_PGP_CommunicationsGroup
DOMAIN_EX\More

Remote:

Everyone
BUILTIN\Users
CONSOLE LOGON
NT AUTHORITY\Authenticated Users
NT AUTHORITY\This Organization
LOCAL

任何人都可以解释差异以及我如何解决这个问题,因为我正在尝试使用组数组来验证用户权限。

4

1 回答 1

0

通过在 IIS 中禁用匿名身份验证来解决此问题。

于 2012-08-02T14:34:35.943 回答