I have two functions which list a users NT groups on an ASP.NET app
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
When run locally (development mode) I get a much longer list than I do when I run on the remote server:
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
Can anyone explain the difference and how I can solve this as I'm trying to use the array of groups to authenticate a users permissions.
Managed to fix this by disabling Anonymous Authentication in IIS.