Member of group?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am working with Visual Basic ASP.NET and creating web forms. I am trying
to write a function where I can input a username and groupname, and the
function will tell me whether that user is a member of that group or not?
However, I am having trouble figuring out how to do this. Can someone help?

Thanks,
Dusty Hackney
 
I believe this to be nontrivial in .NET 1.x, but in .NET 2.0 it's a
joke...

Here's my C# 2.0 code...

StringCollection roles = new StringCollection( );
foreach (IdentityReference reference in WindowsIdentity.GetCurrent(
).Groups) {
string role =
((NTAccount)reference.Translate(typeof(NTAccount))).Value;
roles.Add(role);
}

roles is now the string collection of role names...
 
Thanks for the response. Is there a way to feed the program a different
username (without providing the password) instead of having it use the
currently logged in user?
 
I need to do this exact same function. I need to provide a username and check
their group memberships. Did you ever get a good resolution to this issue?

Thanks!
 
No. I am using VB and .NET 1.x. So far, I haven't figured out how to
accomplish seeing if a user is a member of a group by providing a function a
username and a group name (but no password).
 
Dusty if you are interested in a Domain environment and you re interested in
aRoles based Auth
See my blog at :-http://spaces.msn.com/naijacoder/
Hope that
helps
PAtrick
 
Back
Top