How to change the connection string for NetSqlAzManRoleProvider

Mar 9, 2010 at 1: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 http://forums.asp.net/p/997608/2209437.aspx

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'."}

Coordinator
Mar 10, 2010 at 7:51 AM

Hi,

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.

Regards,

Andrea.

__________________________________
Andrea Ferendeles
NetSqlAzMan Project Coordinator  
E-mail aferende@hotmail.com Web http://netsqlazman.codeplex.com