Description:
It appears that Membership is initialized at startup once and for all, and setting Membership.ApplicationName has no effect after that. I'm tracing this to the MySql.Web.General.Application.FetchId(MySqlConnection) method in MySql.Web.dll. It only sets Application.Id once if it's -1. Subsequent changes in Application.Name have no effect.
This behavior differs from Microsoft's SqlMembershipProvider. My application is an "administrator" and I need this functionality. Please refer to http://msdn.microsoft.com/en-us/library/system.web.security.membership.applicationname.asp...
How to repeat:
Setting Membership.ApplicationName does not have an effect.
Suggested fix:
Either:
1. MySql.Web.General.Application.FetchId(MySqlConnection) method in MySql.Web.dll to be changed as:
public int FetchId(MySqlConnection connection) {
MySqlCommand command = new MySqlCommand("SELECT id FROM my_aspnet_Applications WHERE name=@name", connection);
command.Parameters.AddWithValue("@name", this.Name);
object obj2 = command.ExecuteScalar();
this.Id = (obj2 == null) ? -1 : Convert.ToInt32(obj2);
return this.Id;
}
or (more efficient)
2.1 MySql.Web.General.Application.FetchId(MySqlConnection) method in MySql.Web.dll becomes:
public int FetchId(MySqlConnection connection) { return this.Id; }
2.2 public field Application.Name becomes:
private string name;
public string Name {
get { return this.name; }
set {
if(this.name != value) {
this.name = value;
MySqlCommand command = new MySqlCommand("SELECT id FROM my_aspnet_Applications WHERE name=@name", connection);
command.Parameters.AddWithValue("@name", value);
object obj2 = command.ExecuteScalar();
this.Id = (obj2 == null) ? -1 : Convert.ToInt32(obj2);
}
}