1 Reply Latest reply: Nov 28, 2012 8:23 AM by 940630 RSS

    How to use createuser

    940630
      Hello,

      I do not know how to use this method:
      CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out System.Web.Security.MembershipCreateStatus status)

      In my web.config, I have these defined:
      requiresQuestionAndAnswer="false"
      requiresUniqueEmail="false"

      My questions are:
      1. do I still need to supply email and question/answser?
      2. what is providerUserKey? how can I get it and then give it to createuser method as an input?

      Thanks in advance.
        • 1. Re: How to use createuser
          940630
          I did not find out what was wrong in my code. I switched to use system.web.security.membershipprovider. Now I can create a user.
          Here is the lines which works:

          MembershipProvider provider = Membership.Provider;
          MembershipUser newUser = null;
          MembershipCreateStatus status = new MembershipCreateStatus();
          newUser = provider.CreateUser(user, password, email, null, null, true, null, out status);

          Edited by: YLiAustin on Nov 28, 2012 6:22 AM