title: Sharepoint 2010. Create user using FBA
body: <p>I'm trying to create user in SharePoint 2010 using FBA (Forms Based Authentication).
  I followed the steps in this article to configure FBA: <a href="http://donalconlon.wordpress.com/2010/02/23/configuring-forms-base-authentication-for-sharepoint-2010-using-iis7/" rel="nofollow">http://donalconlon.wordpress.com/2010/02/23/configuring-forms-base-authentication-for-sharepoint-2010-using-iis7/</a></p>
  
  <p>Then I uploaded the FBA package <a href="http://sharepoint2010fba.codeplex.com/" rel="nofollow">http://sharepoint2010fba.codeplex.com/</a>. Web part loaded normally, but the user is not created. If you try to create a user it gives an unknown error.</p>
  
  <p>After that I tried to create authorization form by myself.
  The code below handles the registration event:</p>
  
  <pre><code>    MembershipCreateStatus mcs = new MembershipCreateStatus();
      SPSecurity.RunWithElevatedPrivileges(delegate()
      {
         using (SPSite site = new SPSite("http://makovkasp:30763/"))
         using (SPWeb spWeb = site.OpenWeb())
         { 
            try
            {
  
               MembershipUser membershipUser =
  Membership.Providers["FBAMembershipProvider"].CreateUser(txtLogin.Text,
                                     txtPassword.Text,
                                     txtEmail.Text,
                                     txtSecretQuestion.Text,
                                     txtAnswer.Text, true, null, out mcs);
  
               spWeb.AllowUnsafeUpdates = true;
               SPUser spUser = spWeb.EnsureUser(txtLogin.Text);
               SPGroup spGroup = spWeb.Groups[2];
               spGroup.AddUser(spUser);
               spGroup.Update();
  
            }
            catch (Exception ex)
            {
               System.Console.WriteLine(ex.ToString());
            }
         }
      });
  </code></pre>
  
  <p>After this code is executed, the user creates in SharePoint (I can see it in FBA UserManagement). But it isn't created in FBA database. So, I can't sign in under it's account.
  Anyone knows how to do it?</p>
  
  <p>Thanks.</p>