Bug #68095 MySQLMembershipProvider: GetAllUsers returns null anytime
Submitted: 16 Jan 2013 7:53 Modified: 10 Feb 2013 21:33
Reporter: Flavio Oliveira Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.6.4 OS:Any
Assigned to: Fernando Gonzalez.Sanchez CPU Architecture:Any
Tags: GetAllUsers MySQLMembershipProvider

[16 Jan 2013 7:53] Flavio Oliveira
Description:
Empty collection are returned from the GetAllUsers Method

How to repeat:
C#:

int totalRecords = 0;
MembershipUserCollection oModel = Membership.GetAllUsers(pageNum, pageSize, out totalRecords);
[10 Feb 2013 21:33] Fernando Gonzalez.Sanchez
Hi,

I can't repeat the claim that this method always returns an empty list.
Can you provide more details on how to repro?

For instructions follow this link:
http://dev.mysql.com/doc/refman/5.0/en/connector-net-website-config.html
or for configuring manually follow: http://dev.mysql.com/doc/refman/5.0/en/connector-net-programming-asp-provider.html

As another full example, you can also check unit test MySql.Web.Tests.UserManagement.GetAllUsers at Connector/NET 6.6.4 source code.
[25 Oct 2014 20:48] Michael Gilbert
protected void Page_Load(object sender, EventArgs e)
{
    string current = string.Empty;

    // Get user info
    using (MySqlConnection connection = new MySqlConnection(Host_Procedures.GetConfigConnStr("LocalMySqlServer")))
    {
        connection.Open();
        using (MySqlCommand cmd = new MySqlCommand("SELECT firstname, lastname FROM my_aspnet_users WHERE id=1;", connection))
        {
            using (MySqlDataReader rdr = cmd.ExecuteReader())
            {
                while (rdr.Read())
                {
                    if (!rdr.IsDBNull(0))
                        current = rdr.GetString(0);
                    if (!rdr.IsDBNull(1))
                        current += " -- " + rdr.GetString(1);
                }
            }
        }
    }
    MembershipProvider provider = Membership.Provider;
    MembershipUserCollection users = Membership.GetAllUsers();
}

// code from Login Page_Load.
// I get the user id=1 so I know the database connection is good.
// On some computers the users show up, on others none.  Same database,
// sometimes on a server, sometimes locally.  It is the database, because
// on 2 of my computers I get 0 for local, but get numbers when I point to 
// a server.