Ghyath Serhal
Ghyath Serhal

Reputation: 7632

membership provider + dynamic connection string

I am using the ASP Membership provider and the Profile Provider. As we all know, these providers read their connection string from the web.config, and this means that it is static.

Is there any way to pass the connection string dynamically by code to these providers.

My application will connect to different databases depending on the login name, when the user clicks the login button, i know the connection string of the database, and here I want to pass the connection string to the providers.

Upvotes: 3

Views: 667

Answers (1)

szeliga
szeliga

Reputation: 621

The only way to accommodate this is to create a custom membership provider that takes in a connection string when attempting to validate a user's login.

One thing to take into consideration is that each database will have to have the membership provider's sql scripts run against it to ensure that when the application connects to it, it knows how to respond.

Upvotes: 2

Related Questions