I have a wbe app mvc c#4.0, I want to Initialize DefaultRoleProvider connectionstring from code at runtime (don't want it from web.config). I created a class MyRoleProvider : DefaultRoleProvider
public class MyRoleProvider : DefaultRoleProvider
{
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
base.Initialize(name, config);
// Update the private connection string field in the base class.
bool IsLocal = bool.Parse(ConfigurationManager.AppSettings["IsLocal"] as string);
string connectionString = "local connectionString ... ";
if (IsLocal == false)
connectionString = "prod connectionString ...";
//ToDo- how to set connection string next property of provider.
??
}
}