문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top