RE: Getting the Windows Groups for the Logged On User

From: jzhu (anonymous_at_discussions.microsoft.com)
Date: 03/24/04


Date: Wed, 24 Mar 2004 12:16:09 -0800

This is a frequent asked quesiton. Use PInvoke to call Win32 GetTokenInformation API to TOKEN_INFORMATION_CLASS.TokenGroups, passing in the HttpContext.Current.User.Identity.Token as the parameter as the token handle. The following may help you out:

1. http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=e6098575-dda0-48b8-9abf-e0705af065d9 (Free, undocumented, unsupported. Probably will do want you want).

2. http://www.datamarvel.com/
(More extensive support for Win32 APIs, specially security APIs. It even has a aUserGroups property in its NAccessToken class that returns exactly what you want. You can download a trial version see a sample code there.)

     
     ----- MJ wrote: -----
     
     In my ASP.NET (C#) application, I can use HttpContext.Current.User.Identity.Name to get the name and domain (e.g., DOMAINNAME\USERNAME) of the logged on user. But I can't seem to figure out how to get that users' Windows groups (i.e., I need to get a list of all the Windows groups that the logged on user belongs to).
     
     Does anyone know how to do this?
     
     Thanks



Relevant Pages

  • RE: Getting the Windows Groups for the Logged On User
    ... Use PInvoke to call Win32 GetTokenInformation API to TOKEN_INFORMATION_CLASS.TokenGroups, passing in the HttpContext.Current.User.Identity.Token as the parameter as the token handle. ... (More extensive support for Win32 APIs, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Another basic question
    ... a few cases, to diagnose oddities, but I've certainly never found the need ... to worry about passing 0 to that function. ... return codes from APIs and if there is a fault they ignore it. ...
    (microsoft.public.vb.general.discussion)
  • Re: Laufwerksbuchstaben und Sharename
    ... vermutlich zB PInvoke auf Win32 WNetGetUniversalName ... oder andere APIs, oder WMI: ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: Functions in CE dlls
    ... It lists coredll.lib which means that to PInvoke the CreateFile API you'd ... We don't have an tables mapping DLLs -> APIs, ... windowing which would exclude the corresponding graphics & windowing APIs. ... FWIW, if you can copy the DLL to the desktop, you can run "dumpbin /exports ...
    (microsoft.public.windowsce.app.development)
  • PlaySound, pause etc
    ... If I call PlaySound through PInvoke, is there any way to pause it and resume ... are there any other APIs that would allow me to play a sound ...
    (microsoft.public.dotnet.framework.compactframework)