Pergunta

I have no doubt on how to retrieve membership id from 1 single user:

currentUser = Membership.GetUser(); 
Guid currentUserId = (Guid)currentUser.ProviderUserKey;

but I can´t find a way to retrieve all users id and usernames.

I tried this way:

MembershipUserCollection AllUsers;
AllUsers = GetAllUsers();

From that point I can´t find a way to retrieve Ids and Usernames from AllUsers. Could I get some help from here?

Foi útil?

Solução

I think you're looking for Membership.GetAllUsers()

var users = Membership.GetAllUsers();
foreach (MembershipUser membershipUser in users)
{
    // membershipUser.UserName;
}

http://msdn.microsoft.com/en-us/library/system.web.security.membershipprovider.getallusers.aspx

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top