Copied to clipboard

Flag this post as spam?

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


  • Rasmus Lynggaard 118 posts 325 karma points
    Aug 23, 2011 @ 20:16
    Rasmus Lynggaard
    0

    Problem with createuser

    As I just said, I have a problem with Membership.CreateUser and Umbraco

    I have a function that creates a user. The user gets created as supposed in the members section, but for some reason I cannot login.

    If I go to the Umbraco backend and save the member, without changing anything, I can now log in with that member. Anybody got any idea on what to do?

    CreateUser
    _newMember = Membership.CreateUser(username, clearPass, email);
    Roles.AddUserToRole(_newMember.UserName, "ForumUser");
    _newMember.IsApproved = true;
    Membership.UpdateUser(_newMember);

    var document = new Member((int) _newMember.ProviderUserKey);
    document.getProperty("forumUserPosts").Value = 0;
    document.getProperty("forumUserLastPrivateMessage").Value = document.CreateDateTime;
    document.getProperty("forumUserIsAuthorised").Value = true;
    document.XmlGenerate(new XmlDocument());
    document.Save();

  • Rasmus Lynggaard 118 posts 325 karma points
    Aug 24, 2011 @ 12:11
    Rasmus Lynggaard
    0

    Turned out that I forgot to set a true/false property to 0, which gave me an empty value.

    And in my code in another place this gave an exception, which logged of the user again.

Please Sign in or register to post replies

Write your reply to:

Draft