不同的NT组返回本地/服务器

时间:2012-08-02 13:09:09

标签: asp.net nt

我有两个函数列出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

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

1 个答案:

答案 0 :(得分:0)

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