Membership.GetAllUsers () method does not work in SimpleMembership with a web form

I use method Membership.GetAllUsers()in SimpleMemebershipto get the whole user, but it does not work. It throws the following error: The specified method is not supported .

+4
source share
2 answers

Memberhip.GetAllUsers () will not work with SimpleMembership . If the SimpleMembershipProvider class was initialized by calling WebSecurity.InitializeDatabaseConnection () , this method is not supported and will throw a NotSupportedException . You can see it on the Page page .

An alternative way to get all users in SimpleMemberShip is

dynamic users;
using (var db = WebMatrix.Data.Database.Open("UserDb"))
 {
   users = db.Query("SELECT * FROM Users");
 }

here UserDb is the name of my demo version of ConnectionString. This code can be seen in Page .

+2
source

Memberhip.GetAllUsers() SimpleMembership.

+1

All Articles