Profiles

A

ATR2000

Is there a way to connect to a ProfileProvider programmatically? I have a
Central Administration site that handles multiple application with different
Membership databases. I have tried googling and have found nothing that
refers to having to connect to a provider. Everybody seems to provide a
default only example. Any help is appreciated.

I would like to do something like this:

Dim prof As ProfileCommon =
ProfileCommon.Create(CreateUserWizard1.UserName, True)

if site = "A" then
'Connect to Profile Provider 1
prof.Providers.Item("MyProfileProvider1") '?
elseif site = "B" then
'Connect to Profile Provider 2
prof.Providers.Item("MyProfileProvider2") '?
end if

prof.UserDetails.Field1 = "Value1"
prof.UserDetails.Field2 = "Value2"
prof.UserDetails.Field3 = "Value3"
prof.UserDetails.Field4 = "Value4"
prof.Save()

CURRENT CODE:

web.config:

<profile>
<providers>
<add name="MyProfileProvider1"
connectionStringName="DBConn1"
applicationName="/"
type="System.Web.Profile.SqlProfileProvider"
/>
<add name="MyProfileProvider2"
connectionStringName="DBConn2"
applicationName="/"
type="System.Web.Profile.SqlProfileProvider"
/>
</providers>
<properties>
<group name="UserDetails">
<add name="Field1" type="System.String" />
<add name="Field2" type="System.String" />
<add name="Field3" type="System.String" />
<add name="Field4" type="System.String" />
</group>
</properties>
</profile>

Thanx in advance,

atr2000
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top