Gets a list of the Windows groups that a user is in.
Assembly: System.Web (in System.Web.dll)
- Type: System::String
The user to return the list of Windows groups for in the form DOMAIN\username.
Return ValueType: array<System::String>
A string array containing the names of all the Windows groups that the specified user is in.
The currently executing user does not have an authenticated WindowsIdentity attached to Page::User. For non-HTTP scenarios, the currently executing user does not have an authenticated WindowsIdentity attached to Thread::CurrentPrincipal.
A failure occurred while retrieving the user's Windows group information.
username is nullptr.
The trust level is less than Low.
This method is called by the Roles class to retrieve from the Windows operating system a list of the Windows groups that the specified user is in. The method can be called only for the currently logged-on user, as identified by the LOGON_USER server variable. If the value supplied in the username parameter is not the name of the currently logged-on user, a System.Configuration.Provider::ProviderException is thrown.
For more information an ASP.NET and Windows authentication, see ASP.NET Authentication.
The following code example uses the method to retrieve a list of roles for a specified user and binds the list of roles to a GridView control. For an example of a Web.config file that enables role management, see WindowsTokenRoleProvider.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.