How to use multiple profiles

Discussion in 'ASP .Net Security' started by Peter Afonin, Feb 27, 2010.

  1. Peter Afonin

    Peter Afonin Guest

    Hello,

    I need to retrieve the user data from the different web application. In the
    web.config I can specify different profiles, but I cannot figure out how can
    I use it in the application. This is what I did:

    <profile defaultProvider="i90PartnerProfileProvider">
    <providers>
    <clear/>
    <add name="i90PartnerProfileProvider"
    type="System.Web.Profile.SqlProfileProvider"
    connectionStringName="i90Partner"/>
    <add name="i90ProfileProvider"
    type="System.Web.Profile.SqlProfileProvider" connectionStringName="i90"/>

    </providers>

    <properties>
    <group name="AddInfo">
    <add name="FirstName" type="System.String"/>
    <add name="LastName" type="System.String"/>
    <add name="CompanyName" type="System.String"/>
    <add name="Country" type="System.String"/>
    <add name="City" type="System.String"/>
    <add name="Email2" type="System.String"/>
    <add name="Encoding" type="System.String"/>
    <add name="IP" type="System.String"/>
    </group>
    </properties>
    </profile>

    On this page I need to use the i90ProfileProvider which is not a default
    provider and retrieves the data from a different SQL database using a
    different connection string (i90).

    I know that I can assign different providers to the login control, for
    instance, but how can I retrieve the user data using C# or VB? I've tried to
    play with the MembershipProvider class and some other classes - couldn't
    figure this out.

    I would appreciate your help.

    Thank you,

    Peter
     
    Peter Afonin, Feb 27, 2010
    #1
    1. Advertisements

  2. Peter Afonin

    Peter Afonin Guest

    I have figured out how to get a user using the non-default provider:

    MembershipUser user=
    Membership.Providers["providername"].GetUser("username",false);

    Now all I need is to figure out how to tell the application to use the
    non-default Profile provider, in my case, "i90ProfileProvider".

    I thought this would be much easier than it is.

    "Peter Afonin" <> wrote in message
    news:...
    > Hello,
    >
    > I need to retrieve the user data from the different web application. In
    > the web.config I can specify different profiles, but I cannot figure out
    > how can I use it in the application. This is what I did:
    >
    > <profile defaultProvider="i90PartnerProfileProvider">
    > <providers>
    > <clear/>
    > <add name="i90PartnerProfileProvider"
    > type="System.Web.Profile.SqlProfileProvider"
    > connectionStringName="i90Partner"/>
    > <add name="i90ProfileProvider"
    > type="System.Web.Profile.SqlProfileProvider" connectionStringName="i90"/>
    >
    > </providers>
    >
    > <properties>
    > <group name="AddInfo">
    > <add name="FirstName" type="System.String"/>
    > <add name="LastName" type="System.String"/>
    > <add name="CompanyName" type="System.String"/>
    > <add name="Country" type="System.String"/>
    > <add name="City" type="System.String"/>
    > <add name="Email2" type="System.String"/>
    > <add name="Encoding" type="System.String"/>
    > <add name="IP" type="System.String"/>
    > </group>
    > </properties>
    > </profile>
    >
    > On this page I need to use the i90ProfileProvider which is not a default
    > provider and retrieves the data from a different SQL database using a
    > different connection string (i90).
    >
    > I know that I can assign different providers to the login control, for
    > instance, but how can I retrieve the user data using C# or VB? I've tried
    > to play with the MembershipProvider class and some other classes -
    > couldn't figure this out.
    >
    > I would appreciate your help.
    >
    > Thank you,
    >
    > Peter
     
    Peter Afonin, Mar 2, 2010
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Alexandr Zverev

    User Profiles and ASP 2.0

    Alexandr Zverev, Aug 1, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,427
    Brock Allen
    Aug 2, 2005
  2. Replies:
    0
    Views:
    712
  3. Saber
    Replies:
    5
    Views:
    1,414
    Ken Cox - Microsoft MVP
    Feb 12, 2006
  4. Navin Mishra
    Replies:
    0
    Views:
    420
    Navin Mishra
    Sep 21, 2006
  5. dgk
    Replies:
    2
    Views:
    548
  6. Andy B
    Replies:
    1
    Views:
    720
    Nanda Lella[MSFT]
    Feb 11, 2009
  7. Peter Afonin

    How to use multiple profiles

    Peter Afonin, Feb 27, 2010, in forum: ASP .Net
    Replies:
    1
    Views:
    496
    Peter Afonin
    Mar 2, 2010
Loading...