Use the "MemberGroup.GetByName" and ignore the obsolete class. I know the reason why it was obsoleted, but IMHO it was overkill in doing so - since there isn't a MembershipProvider API that gives you what you need.
If you are really bothered by the Visual Studio warning messages about it, then you can wrap your code in the following directives:
Get Members By Group
Hi there,
I know this has been addressed few times in this forum but I can't really get the information Im looking for.
I would like to get the member details according to group.
I used the following as suggested before:
foreach (var userInRole in Roles.GetUsersInRole("Supplier")) {
var user = new MembershipUser(userInRole);
}
Or,
var user = Membership.GetUser(userInRole);
But this does not give me the required properties such as custom property.
I can get the required information via MemberGroup.GetByName("Supplier").GetMembers();
but it is an obsolete class.
Any idea?
Many thanks
mkariti
Hi mkariti,
Use the "MemberGroup.GetByName" and ignore the obsolete class. I know the reason why it was obsoleted, but IMHO it was overkill in doing so - since there isn't a MembershipProvider API that gives you what you need.
If you are really bothered by the Visual Studio warning messages about it, then you can wrap your code in the following directives:
Cheers, Lee.
Hi mkariti,
Have no fear, those methods are used internally by the MembershipProvider, so they should always be around.
Cheers, Lee.
is working on a reply...