Copied to clipboard

Flag this post as spam?

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


  • Jos Huybrighs 23 posts 55 karma points
    Oct 13, 2014 @ 18:40
    Jos Huybrighs
    0

    CreateUser problem when upgrading v.6.1.x to v.6.2.1 with MembersMembershipProvider

    I am encountering a problem with v.6.2.1 in relation with the new MembersMembershipProvider. I am upgrading a 6.1 website to 6.2 (where the new member provider has been introduced) and seeing various Exceptions coming up when I create members through the API.

    The code I use looks as follows:

    UmbracoMembershipProviderBase provider = (UmbracoMembershipProviderBase)Membership.Providers["UmbracoMembershipProvider"];
    var mt = new MemberType(1093);
    
    MembershipCreateStatus createStatus = new MembershipCreateStatus();
    MembershipUser membershipUser = provider.CreateUser(mt.Alias,
                                                        userName, password, emailAdj,
                                                        "empty", "empty", true,
                                                        null, out createStatus);
    
    When calling provider.CreateUser the following exception comes up:
    You must specify a non-autogenerated machine key to store passwords in the encrypted format. Either specify a different passwordFormat, or change the machineKey configuration to use a non-autogenerated decryption key.

    The error occurs in:

    - StackTrace:
      at System.Web.Security.MembershipProvider.EncryptPassword(Byte[] password, MembershipPasswordCompatibilityMode legacyPasswordCompatibilityMode)
      at Umbraco.Web.Security.Providers.UmbracoMembershipProvider`2.EncryptString(String str)
      at Umbraco.Web.Security.Providers.UmbracoMembershipProvider`2.PerformCreateUser(String memberTypeAlias, String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status)
    ..
    etc

    I never had to provide a machine key for generating a password hash (on 6.1 and older) so this seems very strange.

    Still stranger: although none of the created members are visible in the Members section of the umbraco backoffice; members do seem to be added to the repository. I indeed also have this utility to update members and when I run this subsequently (with the members that could not be created) all members indeed appear in the backoffice. No exception occurs then.

    By the way: the same exception comes up when using the asp.net 'standard' provider method to create a user (i.e. not using the cast).

    Any idea?

  • Warren 30 posts 95 karma points
    Apr 23, 2015 @ 06:37
    Warren
    0

    I having the same issue.

    Did you resolve this issue?

  • Warren 30 posts 95 karma points
    Apr 24, 2015 @ 01:20
    Warren
    0

    I worked it out.

    I had not updated the web.config to reflect the new membership provider details.

    Error had stop since I did that. (I need to read the relaese notes more carefully!)

    Here are the new Membership priovider section. If others are having the same issue, check out what is in your web.confg file.

        <!-- Membership Provider -->

        <membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15">

          <providers>

            <clear/>

            <add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Another Type" passwordFormat="Hashed" />

            <add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" passwordFormat="Hashed" />

          </providers>

        </membership>

        <!-- added by NH to support membership providers in access layer -->

        <roleManager enabled="true" defaultProvider="UmbracoRoleProvider">

          <providers>

            <clear/>

            <add name="UmbracoRoleProvider" type="umbraco.providers.members.UmbracoRoleProvider" />

          </providers>

        </roleManager>

      </system.web>

Please Sign in or register to post replies

Write your reply to:

Draft