RE: Getting the Windows Groups for the Logged On User
From: jzhu (anonymous_at_discussions.microsoft.com)
Date: 03/24/04
- Next message: David Pinz: "Re: Capicom envelopeddata.decrypt failing when content > 64k"
- Previous message: Dimitris Papadimitriou: "Re: signing small pieces of data"
- In reply to: MJ: "Getting the Windows Groups for the Logged On User"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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
- Next message: David Pinz: "Re: Capicom envelopeddata.decrypt failing when content > 64k"
- Previous message: Dimitris Papadimitriou: "Re: signing small pieces of data"
- In reply to: MJ: "Getting the Windows Groups for the Logged On User"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|