CreateUser Samples in ASP.NET 2.0 not working


In going through my samples for tonights user group i found i could not get the overloads for CreateUser working that didn’t supply all the parameters…Even the samples on MSDN

weren’t working for me.


I wish i could say it was through superiour debugging prowess i fgured it out when actualaty it ended being GeoffAppleby  reading the documentation to figured it out<g>


Thanks Geoff!


In either case the cause was the config setting below defaults to true…



requiresQuestionAndAnswer=false


 


More complete Sample below


 



Protected Sub CreatUser_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserlnk.Click


Dim newUser As MembershipUser = Membership.CreateUser(UsernameTextbox.Text, PasswordTextbox.Text,email.text)


End Sub


 



<appSettings/>


<connectionStrings>


<add name=”ASPNETDBConnectionString1″ connectionString=”Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True”


providerName=”System.Data.SqlClient” />


</connectionStrings>


<system.web>


<!–


Set compilation debug=”true” to insert debugging


symbols into the compiled page. Because this


affects performance, set this value to true only


during development.


–>


<authorization>



<allow users=”?” />


</authorization>


<roleManager enabled=”true” />


<membership defaultProvider=”SqlProvider” userIsOnlineTimeWindow=”20″>


<providers>


<remove name=”AspNetSqlProvider” />


<add name=”SqlProvider”


type=”System.Web.Security.SqlMembershipProvider”



connectionStringName=”ASPNETDBConnectionString1″


enablePasswordRetrieval=”false”


enablePasswordReset=”true”


requiresQuestionAndAnswer=”false”


passwordFormat=”Hashed”


applicationName=”/” />


</providers>


</membership>


 


 


Comments (4)

  1. Wow. Been a pretty day. Two cool things.

    First, I won a book. Yay me! Chuck had a question about some…

  2. Wow. Been a pretty day. Two cool things.

    First, I won a book. Yay me! Chuck had a question about some…

  3. Wow. Been a pretty day. Two cool things.

    First, I won a book. Yay me! Chuck had a question about some…

  4. Wow. Been a pretty day. Two cool things.

    First, I won a book. Yay me! Chuck had a question about some…