I resolved this with multiple profiles and providers using the following hack:
First: create a base class for your profiles. It should not contain all fields; it is simply important that they have the same base class (I called it CustomProfileBase).
, config:
app.config
<system.web>
<membership defaultProvider="CustomSqlProviderA" userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="CustomSqlProviderA" applicationName="websiteA" type="Authenticatie.A.CustomMembershipProvider, Authenticatie" description="A Membership" connectionStringName="profilesA" />
<add name="CustomSqlProviderB" applicationName="websiteB" type="Authenticatie.B.CustomMembershipProvider, Authenticatie" description="B Membership" connectionStringName="profilesB" />
</providers>
</membership>
<profile inherits="Authenticatie.CustomProfileBase, Authenticatie" defaultProvider="AProfielen" enabled="true">
<providers>
<add name="AProfielen" applicationName="websiteA" type="Authenticatie.A.CustomProfileProvider, Authenticatie" connectionStringName="profielenA" description="A"/>
<add name="BProfielen" applicationName="websiteB" type="Authenticatie.B.CustomProfileProvider, Authenticatie" connectionStringName="profielenB" description="B"/>
</providers>
</profile>
</system.web>
var membershipProvider = Membership.Providers.Cast<MembershipProvider>().Single(s => s.ApplicationName == (website == Website.A ? "websiteA" : "websiteB"));
var profileProvider = ProfileManager.Providers[website == Website.A ? "AProfielen" : "BProfielen"];
FieldInfo cPr = typeof(ProfileManager).GetField("s_Provider", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
cPr.SetValue(null, profileProvider);
var user = membershipProvider.GetUser(gebruikersData.EmailAdres, false);
if (user == null)
{
membershipProvider.CreateUser(mail, password, mail, null, null, true, null, out createStatus);
var profile = (CustomProfileBase)ProfileBase.Create(mail);
profile.Save();
}
. membershipProvider ProfileManager.FindProfilesByUserName().