I need to set the connectionString everytime I use Membership.yadayada depending on the language selected
This isn't feasible: consider what happens when two requests from users with different languages are processed concurrently. If you changed the connection string for user A, it would affect user B.
What you could do is write a custom Membership provider which aggregates two (or more) SqlMembershipProviders, and redirects based on the current user's language.
public class MyMembershipProvider : MembershipProvider
{
private Dictionary<string, MembershipProvider> _languageMembeshipProviders;
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
{
... create an SqlMembershipProvider for each language and add to
... the languageMembeshipProviders dictionary
}
public override bool ValidateUser(...)
{
... Get language from HttpContext.Current somehow
... select a provider from the dictionary
... call the provider
}
}
However I find it difficult to understand how this could work in practice. Presumably there's something in the request (querystring, cookie, accept-languages header) to indicate the user's language. If so, a user could potentially be authenticated using one language, then switch to access the other database by changing the language in his request.
I'd have thought it would be simpler and cleaner to have separate applications for each language. If a user arrives on site A indicating he wants language B, then he should be redirected to the application B.