Membership.CreateUser : Membership « Login Security « ASP.Net

Home
ASP.Net
1.ADO.net Database
2.Ajax
3.Asp Control
4.Collections
5.Components
6.Data Binding
7.Development
8.File Directory
9.HTML Control
10.Language Basics
11.Login Security
12.Mobile Control
13.Network
14.Page
15.Request
16.Response
17.Server
18.Session Cookie
19.Sitemap
20.Theme Style
21.User Control and Master Page
22.Validation by Control
23.Validation by Function
24.WebPart
25.WPF
26.XML
ASP.Net » Login Security » Membership 




Membership.CreateUser


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="AddUser_aspx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    UserID<asp:TextBox ID="txtUserID" runat="server"></asp:TextBox>
    Password<asp:TextBox ID="txtPassword1" runat="server" TextMode="Password"></asp:TextBox>
    Confirm Password<asp:TextBox ID="txtPassword2" runat="server" TextMode="Password"></asp:TextBox>
    Security Question<asp:TextBox ID="txtQn" runat="server"></asp:TextBox>
    Answer<asp:TextBox ID="txtAns" runat="server"></asp:TextBox>
    Email<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
   <asp:Button ID="btnAddUser" runat="server" Text="Add User" /><br />
    </form>
</body>
</html>

File: Default.aspx.vb

Imports System.Web.Security
Partial Class AddUser_aspx
    Inherits System.Web.UI.Page

    Protected Sub btnAddUser_Click(ByVal sender As Object, _
                                   ByVal e As System.EventArgs_
                                   Handles btnAddUser.Click
        Dim IsCreated As MembershipCreateStatus
        If (txtPassword1.Text = txtPassword2.TextThen
            Membership.CreateUser(txtUserID.Text, txtPassword1.Text, _
              txtEmail.Text, txtQn.Text, txtAns.Text, True, IsCreated)
            Response.Write("Add user: " & IsCreated.ToString)
        Else
            Response.Write("Passwords do not match")
        End If
    End Sub
End Class

 














Related examples in the same category
1.Displaying the number of users online
2.User info
3.Membership.GetUser
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.