determine if item is in array, how??

J

Jeff

ASP.NET 2.0

Below are some code from my webproject. What I'm trying to do is create a
MembershipUserCollection which holds users of the role "member"

this line:
string[] role = Roles.GetRolesForUser(user.UserName);
generates an array consisting of the roles belonging to the user. I'm a bit
stuck here. I need to quickly determine if this array have an item named
"member" within it... I know I can just create a simple for loop and loop
through the entire array but I hope there is some kind of direct access like
for example role["member"]...

MembershipUserCollection allUsers = Membership..GetAllUsers();
MembershipUserCollection members = new MembershipUserCollection();
foreach (MembershipUser user in allUsers)
{
string[] role = Roles.GetRolesForUser(user.UserName);
role.
}

any suggestions? Maybe you have a better way of getting the users belonging
to a role, then
please share it with me :)

Best Regards

Jeff
 
C

clintonG

In your source enter HttpContext.Current.User and use Intellisense to review
the properties available. There are two you may find useful.
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top