views:

99

answers:

1

This is the Membership API in .NET 2.0. Suddenly it stopped working on me. I've stripped it to the basics. I get no response when I try to create a user. It goes through the code with no error, but nothing happens. Here is the code in the aspx:

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim mcf As System.Web.Security.MembershipCreateStatus
    Membership.CreateUser("kingfish", "password1", "[email protected]", "what is it?", "widget", True, mcf)
End Sub

and here is the code in the web.config:

     <add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=MyDB;Integrated Security=True" providerName="System.Data.SqlClient"/>

    <membership defaultProvider="CustomizedProvider">
  <providers>
    <add name="CustomizedProvider"
         type="System.Web.Security.SqlMembershipProvider"  
         connectionStringName="LocalSqlServer"
         applicationName="MyApp"
         minRequiredPasswordLength="5"
         minRequiredNonalphanumericCharacters="0" />
  </providers>
</membership>
A: 

I had to check the MembershipCreateStatus. Seems I was sending in duplicate emails and this isn't allowed.

donde
If you want, you can allow duplicate emails by adding this:<add name="CustomizedProvider" requiresUniqueEmail="false" ....
Stefan