Creating users programmatically (VB) : Membership « Authentication Authorization « ASP.NET Tutorial






<%@ Page Language="VB" %>

<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
   Try
      Membership.CreateUser(TextBox1.Text, TextBox2.Text)
      Label1.Text = "Successfully created user " & TextBox1.Text
   Catch ex As MembershipCreateUserException
      Label1.Text = "Error: " & ex.ToString()
   End Try
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Creating a User</title>
</head>
<body>
    <form id="form1" runat="server">
        <h1>Create User</h1>
        Username<br />
            <asp:TextBox ID="TextBox1" Runat="server"></asp:TextBox>
        
        Password<br />
            <asp:TextBox ID="TextBox2" Runat="server" 
             TextMode="Password"></asp:TextBox>
        
        
            <asp:Button ID="Button1" Runat="server" Text="Create User" 
             OnClick="Button1_Click" />
        
        
            <asp:Label ID="Label1" Runat="server"></asp:Label>
        
    </form>
</body>
</html>








21.11.Membership
21.11.1.Using ASP.NET Membership
21.11.2.Setting Up Your Web Site for Membership
21.11.3.Using the Membership Application Programming Interface
21.11.4.Use the methods of the Membership class to create custom Login controls.
21.11.5.Configure how passwords are stored by setting the passwordFormat attribute in the web configuration file.
21.11.6.Disable this requirement when using the SqlMembershipProvider.
21.11.7.Locking Out Bad Users
21.11.8.After a user has been locked out, you must call the MembershipUser.UnlockUser() method to re-enable the user account.
21.11.9.The web configuration file used to set up the XmlMembershipProvider
21.11.10.Creating users programmatically (C#)
21.11.11.Creating users programmatically (VB)
21.11.12.Membership provider settings in the machine.config file
21.11.13.Denying unauthenticated users