Member of group?

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
 
A

agapeton

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...
 
G

Guest

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?
 
G

Guest

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!
 
G

Guest

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).
 
P

Patrick.O.Ige

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top