Reputation: 12253
We are using a membership provider based on universal provider and I want to change the connection string that it uses at runtime.
The following question http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/260d8536-c39f-41ec-b181-4d452cf054b3/ shows how to change SQL membership provider at runtime.
However if I do it with System.Web.Providers.DefaultMembershipProvider then it doesn't work as it doesn't seem to have have _sqlConnectionString field to set.
Any ideas?
Upvotes: 2
Views: 774
Reputation: 12253
I used the code from the following blog post
Basically I inherited defaultmembershipprovider override its Initialize method accessed its connectionstringname and then used the ConfigurationManager http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx to update the web.config
Upvotes: 1