Reputation: 21
My tables have been created in my database for both aspnet_Membership, aspnet_Users for Membership and I AspNetUsers since I was using a different way before. Anyways, my connection is good to my database since it was inserting users into AspNetUsers but I want to use Membership so when I call Membership.CreateUser(), it doesn't insert into my table aspnet_Membership.
Any ideas?
Web.config
<connectionStrings>
<add name="DefaultConnection"
connectionString="Data Source=LAPTOP\SQLExpress; Initial Catalog=Application; Integrated Security=True;"
providerName="System.Data.SqlClient" />
</connectionStrings>
<membership defaultProvider="MembershipProvider" userIsOnlineTimeWindow="10">
<providers>
<add name="MembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionString="Data Source=LAPTOP\SQLExpress; Initial Catalog=Application; Integrated Security=True;" connectionStringName="DefaultConnection" applicationName="Application"/>
</providers>
</membership>
Register.aspx.cs
protected void CreateUser_Click(object sender, EventArgs e)
{
if (!Username.Text.Equals("") && !Password.Text.Equals("") && !Email.Text.Equals(""))
{
MembershipCreateStatus createStatus;
MembershipUser newUser = Membership.CreateUser(Username.Text, Password.Text, Email.Text, "", "", true, out createStatus);
}
}
Upvotes: 2
Views: 1833
Reputation: 12561
Check the value of your createStatus
enum to see why it failed to create the user. You can also use the Website Administration Tool to create the user manually and see if you get any more informative error messages.
Upvotes: 1