How to change the connection string for NetSqlAzManRoleProvider

Mar 9, 2010 at 2:54 PM

The user will change the db connection when run his application, so there will is a windows form, the user can change it, however, refer to the

var roleField = Roles.Provider.GetType().GetField("_sqlConnectionString", BindingFlags.Instance | BindingFlags.NonPublic);
if (roleField != null)
roleField.SetValue(Roles.Provider, connectionString);

The codes run well for SqlRoleProvider, but for the NetSqlAzMan.Providers.NetSqlAzManRoleProvider, the following error will be thrown.

{"Cannot open database \"MyTestDB\" requested by the login. The login failed.\r\nLogin failed for user 'sa'."}

Mar 10, 2010 at 8:51 AM


Try add “Persist Security Info=True” in your source connection string. Without this part … you are not able to read again User id and password from a SQL connection string.



Andrea Ferendeles
NetSqlAzMan Project Coordinator  
E-mail Web