D
David Thielen
Hi;
When we create the membership DB we have to create the admin user in it in
our setup program. Otherwise, there is no way for an admin to get in our
ASP.NET app and create additional users.
What we have works unless the user first selects the wrong database for
which database is the membership database (this step occurs when they created
the database and then cancel or an error occurs before the admin member is
added).
I think what is happening is that the SqlRoleProvider is not re-reading the
setup app's config file. We update the file as follows before create the
SqlRoleProvider object.
VendorInfo info = new SqlServerInfo();
Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ConnectionStringsSection cs =
(ConnectionStringsSection)config.GetSection("connectionStrings");
cs.ConnectionStrings.Remove("MembershipSqlServer");
config.Save();
ConfigurationManager.RefreshSection("connectionStrings");
// ConnectionStringSettingsCollection csc =
ConfigurationManager.ConnectionStrings;
cs.ConnectionStrings.Add(new
ConnectionStringSettings("MembershipSqlServer", connStr, info.ClassName));
config.Save();
ConfigurationManager.RefreshSection("connectionStrings");
ConnectionStringSettingsCollection csc =
ConfigurationManager.ConnectionStrings;
object obj = csc["MembershipSqlServer"];
cs = (ConnectionStringsSection)config.GetSection("connectionStrings");
csc = cs.ConnectionStrings;
obj = csc["MembershipSqlServer"];
obj is the correct connection string the second time (the first time it's
wrong as I entered it wrong to test this).
The error I get is when I call the roleProvider object to check IsInRole it
tells me it cannot find the stored procedure it uses.
Any ideas how to work around this?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
When we create the membership DB we have to create the admin user in it in
our setup program. Otherwise, there is no way for an admin to get in our
ASP.NET app and create additional users.
What we have works unless the user first selects the wrong database for
which database is the membership database (this step occurs when they created
the database and then cancel or an error occurs before the admin member is
added).
I think what is happening is that the SqlRoleProvider is not re-reading the
setup app's config file. We update the file as follows before create the
SqlRoleProvider object.
VendorInfo info = new SqlServerInfo();
Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ConnectionStringsSection cs =
(ConnectionStringsSection)config.GetSection("connectionStrings");
cs.ConnectionStrings.Remove("MembershipSqlServer");
config.Save();
ConfigurationManager.RefreshSection("connectionStrings");
// ConnectionStringSettingsCollection csc =
ConfigurationManager.ConnectionStrings;
cs.ConnectionStrings.Add(new
ConnectionStringSettings("MembershipSqlServer", connStr, info.ClassName));
config.Save();
ConfigurationManager.RefreshSection("connectionStrings");
ConnectionStringSettingsCollection csc =
ConfigurationManager.ConnectionStrings;
object obj = csc["MembershipSqlServer"];
cs = (ConnectionStringsSection)config.GetSection("connectionStrings");
csc = cs.ConnectionStrings;
obj = csc["MembershipSqlServer"];
obj is the correct connection string the second time (the first time it's
wrong as I entered it wrong to test this).
The error I get is when I call the roleProvider object to check IsInRole it
tells me it cannot find the stored procedure it uses.
Any ideas how to work around this?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm