Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • nickornotto 403 posts 907 karma points
    May 17, 2013 @ 13:16
    nickornotto
    0

    Create member with correct type dynamically

    I have 2 member types in my Umbraco 6:

    * Member1

    * Member2

    and I'm using .net Membership providers.

    This is what I have in my web.config:

    <membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15">
    <providers>
    <clear />
    <add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" connectionStringName="umbracoDbDSN" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Member" passwordFormat="Hashed" />
    <add name="UmbracoMembershipProviderMember2" type="umbraco.providers.members.UmbracoMembershipProvider" connectionStringName="umbracoDbDSN" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="member2" passwordFormat="Hashed" />
    <add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" passwordFormat="Hashed" />
    </providers>
    </membership>
    <profile defaultProvider="UmbracoMembershipProvider" enabled="true" inherits="My.Member">
    <providers>
    <clear />
    <add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoProfileProvider, umbraco.providers" />
    <add name="UmbracoMembershipProviderMember2" type="umbraco.providers.members.UmbracoProfileProvider, umbraco.providers" />
    </providers>
    <properties>
    <clear />
    <add name="memberTitle" allowAnonymous ="false" provider="UmbracoMembershipProvider" type="System.String" />
    <add name="memberFirstNames" allowAnonymous ="false" provider="UmbracoMembershipProvider" type="System.String" />
        <add name="memberSurname" allowAnonymous ="false" provider="UmbracoMembershipProvider" type="System.String" />
    </properties>
    </profile>

    I know I need to create another provider which I did: UmbracoMembershipProviderMember2

    Now, my profile properties use UmbracoMembershipProvider, how can I assign them to UmbracoMembershipProviderMember2 too?

    If I cannot assign the same properties to UmbracoMembershipProviderMember2 - how can I assign another class to UmbracoMembershipProviderMember2?

    For UmbracoMembershipProvider it is done in this line:

    <profile defaultProvider="UmbracoMembershipProvider" enabled="true" inherits="My.Member">

    but this line must be unique in web.config so I cannot add anything like this:

    <profile defaultProvider="UmbracoMembershipProviderMember2" enabled="true" inherits="My.Member2">

     

    And the most of all:

    How can I assign the correct provider/ member type to a new member created in code behind?

     

    Thank you

Please Sign in or register to post replies

Write your reply to:

Draft