<%@ Page Language="VB" %>

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

<script runat="server">
    Protected Sub cmdRegister_Click1(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim Status As MembershipCreateStatus
        Dim NewUser As MembershipUser = Membership.CreateUser(txtUser.Text, txtPassword.Text, txtEmail.Text, txtQuestion.Text, txtAnswer.Text, True, Status)

        ' Jeśli konto zostało utworzone pomyślnie,
        ' przekierowujemy użytkownika do strony logowania.
        If Status = MembershipCreateStatus.Success Then
            Response.Redirect("Login.aspx")
        Else
            ' Wyświetlamy komunikat o błędzie
            lblStatus.Text = "Próba utworzenia konta zakończyła się błędem " & _
              Status.ToString()
        End If
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Nazwa &nbsp; :
        <asp:TextBox ID="txtUser" runat="server"></asp:TextBox><br />
        <br />
        Hasło:&nbsp; &nbsp; &nbsp; &nbsp;<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox><br />
        <br />
        E-mail:&nbsp; &nbsp; &nbsp;<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox><br />
        <br />
        Pytanie: &nbsp; &nbsp;<asp:TextBox ID="txtQuestion" runat="server"></asp:TextBox><br />
        <br />
        Odpowiedź:
        <asp:TextBox ID="txtAnswer" runat="server"></asp:TextBox><br />
        <br />
        <asp:Button ID="cmdRegister" runat="server" Text="Zarejestruj" Width="96px" OnClick="cmdRegister_Click1" />
        <br />
        <br />
        <asp:Label ID="lblStatus" runat="server" Width="398px"></asp:Label><br />
    </div>
    </form>
</body>
</html>
