I have multiple profile providers and profile types:
ProviderA with ProfileA
and
ProviderB with ProfileB
They both use a different database. I want to be able to say:
ProfileB.Create(...), and the profile is created in database B, whilst ProfileA.Create(...) creates the profile in database A.
How the hell do I configure this in my web.config?
The following is (of course) invalid:
<profile inherits="ProfileA, Authenticatie" defaultProvider="ProfileProviderA" enabled="true" automaticSaveEnabled="true">
<providers>
<add name="ProfileProviderA" applicationName="websiteA" type="ProfileProviderA, Authenticatie" connectionStringName="connstringA" description=""/>
</providers>
</profile>
<profile inherits="ProfileB, Authenticatie" defaultProvider="ProfileProviderB" enabled="true" automaticSaveEnabled="true">
<providers>
<add name="ProfileProviderB" applicationName="websiteB" type="ProfileProviderB, Authenticatie" connectionStringName="connstringB" description=""/>
</providers>
</profile>
I have resolved this with multiple profiles and providers, using the following hack:
First: create a base class for your profiles. It doesn’t have to contain all the fields; it’s just important they share the same base class (I called this
CustomProfileBase).Furthermore the following change in config:
app.config
code
Now we have created a user in the according database along with a profile. You can retrieve the user through the
membershipProviderand the profile throughProfileManager.FindProfilesByUserName().