Tak jsem to vyřešil následně VB.NET CODE
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
RegisterUser.ContinueDestinationPageUrl = Request.QueryString("ReturnUrl")
Response.Expires = 60
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D)
Response.AddHeader("pragma", "no-cache")
Response.AddHeader("cache-control", "private")
Response.CacheControl = "no-cache"
End Sub
Protected Sub RegisterUser_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles RegisterUser.CreatedUser
FormsAuthentication.SetAuthCookie(RegisterUser.UserName, False)
Roles.AddUserToRole(RegisterUser.UserName, "users")
Dim continueUrl As String = RegisterUser.ContinueDestinationPageUrl
If String.IsNullOrEmpty(continueUrl) Then
continueUrl = "~/"
End If
Response.Redirect(continueUrl)
Dim PB As ProfileBase = ProfileBase.Create(RegisterUser.UserName.ToString)
PB.SetPropertyValue("FirstName", FirstNameBox.Text)
PB.SetPropertyValue("LastName", LastNameBox.Text)
PB.SetPropertyValue("CompanyName", CompanyNameBox.Text)
PB.SetPropertyValue("Street", StreetBox.Text)
PB.SetPropertyValue("HouseNumber", HouseNumberBox.Text)
PB.SetPropertyValue("Adress", AdressBox.Text)
PB.SetPropertyValue("PostalCode", PostalCodeBox.Text)
PB.SetPropertyValue("TelNumber", TelNumberBox.Text)
PB.SetPropertyValue("FaxNumber", FaxNumberBox.Text)
PB.SetPropertyValue("MobilNumber", MobilNumberBox.Text)
PB.SetPropertyValue("IcqNumber", IcqNumberBox.Text)
PB.SetPropertyValue("SkypeName", SkypeBox.Text)
PB.SetPropertyValue("Jabber", JabberBox.Text)
PB.SetPropertyValue("Country", CountryDropDown.Id)
PB.SetPropertyValue("Question", QuestionDropDown.Id)
PB.SetPropertyValue("Answer", AnswerBox.Text)
PB.Save()
End Sub
Script
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MainPages %>"
SelectCommand="SELECT * FROM [States] ORDER BY [name]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:MainPages %>"
SelectCommand="SELECT * FROM [Questions] ORDER BY [IdQuestion]">
</asp:SqlDataSource>
<!-- START RIGHT BOX -->
<div class="box2">
<br />
<div class="top">
<h2>
Registrace
</h2>
</div>
<div class="cont">
<asp:CreateUserWizard ID="RegisterUser" runat="server" Width="630px">
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
<ContentTemplate>
<p>
Použijte níže uvedený formulář pro vytvoření nového účtu.
</p>
<p>
Heslo musí mít minimálně 6 znaků.
</p>
<span class="failureNotification">
<asp:Literal ID="ErrorMessage" runat="server"></asp:Literal>
</span>
<asp:ValidationSummary ID="RegisterUserValidationSummary" runat="server" CssClass="failureNotification"
ValidationGroup="RegisterUserValidationGroup"/>
<div class="accountInfo">
<fieldset class="register">
<legend>
Informace o účtu
</legend>
<table>
<tr>
<td>
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" CssClass="Label">Uživatelské jméno:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email" CssClass="Label">E-Mail:</asp:Label>
</td>
<td>
<asp:TextBox ID="Email" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email"
CssClass="failureNotification" ErrorMessage="E-mail is required." ToolTip="E-mail is required."
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password" CssClass="Label">Heslo:</asp:Label>
</td>
<td>
<asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required."
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword" CssClass="Label">Potvrdit heslo:</asp:Label>
</td>
<td>
<asp:TextBox ID="ConfirmPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="ConfirmPassword" CssClass="failureNotification" Display="Dynamic"
ErrorMessage="Confirm Password is required." ID="ConfirmPasswordRequired" runat="server"
ToolTip="Confirm Password is required." ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
<asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword"
CssClass="failureNotification" Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match."
ValidationGroup="RegisterUserValidationGroup">*</asp:CompareValidator>
</td>
</tr>
</table>
</fieldset>
<p class="submitButton">
<asp:Button ID="CreateUserButton" runat="server" CommandName="MoveNext" Text="Vytvořit účet"
ValidationGroup="RegisterUserValidationGroup"/>
</p>
</div>
</ContentTemplate>
<CustomNavigationTemplate>
</CustomNavigationTemplate>
</asp:CreateUserWizardStep>
<asp:WizardStep ID="CreateProfile" runat="server" Title="Ukaž" StepType="Start">
<p>
Použijte níže uvedený formulář pro vytvoření profilu.
</p>
<p>
Bez vyplněného profilu nemůžete objednávat vytvoření webových stránek.
</p>
<span class="failureNotification">
<asp:Literal ID="ErrorMessage" runat="server"></asp:Literal>
</span>
<asp:ValidationSummary ID="RegisterUserValidationSummary" runat="server" CssClass="failureNotification"
ValidationGroup="RegisterUserValidationGroup"/>
<div class="accountInfo">
<fieldset class="register">
<legend>
Vytvoření profilu
</legend>
<table>
<tr>
<td>
<asp:Label ID="FirstNameLabel" runat="server" AssociatedControlID="FirstNameLabel" CssClass="Label">Jméno:</asp:Label>
</td>
<td>
<asp:TextBox ID="FirstNameBox" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="FirstNameRequired" runat="server" ControlToValidate="FirstNameBox"
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LastNameLabel" runat="server" AssociatedControlID="LastNameLabel" CssClass="Label">Příjmení:</asp:Label>
</td>
<td>
<asp:TextBox ID="LastNameBox" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="LastNameRequired" runat="server" ControlToValidate="LastNameBox"
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
<tr>
<td>
<asp:Label ID="CompanyNameLabel" runat="server" AssociatedControlID="CompanyNameLabel" CssClass="Label">Jméno Firmy:</asp:Label>
</td>
<td>
<asp:TextBox ID="CompanyNameBox" runat="server" CssClass="textEntry"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
<tr>
<td>
<asp:Label ID="StreetLabel" runat="server" AssociatedControlID="StreetLabel" CssClass="Label">Ulice:</asp:Label>
</td>
<td>
<asp:TextBox ID="AdressBox" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="AdressRequired" runat="server" ControlToValidate="StreetBox"
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="HouseNumberLabel" runat="server" AssociatedControlID="HouseNumberLabel" CssClass="Label">Číslo popisné:</asp:Label>
</td>
<td>
<asp:TextBox ID="HouseNumberBox" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="HouseNumberBox"
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="AdressLabel" runat="server" AssociatedControlID="AdressLabel" CssClass="Label">Město:</asp:Label>
</td>
<td>
<asp:TextBox ID="StreetBox" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="StreetRequired" runat="server" ControlToValidate="AdressBox"
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="PostalCodeLabel" runat="server" AssociatedControlID="PostalCodeLabel" CssClass="Label">PSČ:</asp:Label>
</td>
<td>
<asp:TextBox ID="PostalCodeBox" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="PostalCodeRequired" runat="server" ControlToValidate="PostalCodeBox"
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
<tr>
<td>
<asp:Label ID="TelNumberLabel" runat="server" AssociatedControlID="TelNumberLabel" CssClass="Label">Tel.:</asp:Label>
</td>
<td>
<asp:TextBox ID="TelNumberBox" runat="server" CssClass="textEntry"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="FaxNumberLabel" runat="server" AssociatedControlID="FaxNumberLabel" CssClass="Label">FAX:</asp:Label>
</td>
<td>
<asp:TextBox ID="FaxNumberBox" runat="server" CssClass="textEntry"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="MobilNumberLabel" runat="server" AssociatedControlID="MobilNumberLabel" CssClass="Label">Mobil:</asp:Label>
</td>
<td>
<asp:TextBox ID="MobilNumberBox" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="MobilNumberRequired" runat="server" ControlToValidate="MobilNumberBox"
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="IcqNumberLabel" runat="server" AssociatedControlID="IcqNumberLabel" CssClass="Label">ICQ:</asp:Label>
</td>
<td>
<asp:TextBox ID="IcqNumberBox" runat="server" CssClass="textEntry"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="SkypeLabel" runat="server" AssociatedControlID="SkypeLabel" CssClass="Label">Skype:</asp:Label>
</td>
<td>
<asp:TextBox ID="SkypeBox" runat="server" CssClass="textEntry"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="JabberLabel" runat="server" AssociatedControlID="JabberLabel" CssClass="Label">Jabber:</asp:Label>
</td>
<td>
<asp:TextBox ID="JabberBox" runat="server" CssClass="textEntry"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
<tr>
<td>
<asp:Label ID="CountryLabel" runat="server" AssociatedControlID="CountryLabel" CssClass="Label">Země původu:</asp:Label>
</td>
<td>
<asp:DropDownList ID="CountryDropDown" runat="server"
DataSourceID="SqlDataSource1" DataTextField="name"
DataValueField="IdState"
AppendDataBoundItems="True"
SelectedValue='<%# Bind("Country") %>'
CssClass="DropDown" >
<asp:ListItem Text="Nevybráno" Value="100" />
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="CountryDropDown"
CssClass="failureNotification" ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
<tr>
<td>
<asp:Label ID="QuestionLabel" runat="server" AssociatedControlID="QuestionLabel" CssClass="Label">Bezpečnostní otázka:</asp:Label>
</td>
<td>
<asp:DropDownList ID="QuestionDropDown" runat="server"
DataSourceID="SqlDataSource2" DataTextField="NameQuestion"
DataValueField="IdQuestion"
AppendDataBoundItems="True"
SelectedValue='<%# Bind("Question") %>'
CssClass="DropDown" >
<asp:ListItem Text="Nevybráno" Value="" />
</asp:DropDownList>
<asp:RequiredFieldValidator ID="QuestionRequired" runat="server" ControlToValidate="QuestionDownList"
CssClass="failureNotification" ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="AnswerLabel" runat="server" AssociatedControlID="AnswerLabel" CssClass="Label">Odpověď:</asp:Label>
</td>
<td>
<asp:TextBox ID="AnswerBox" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="AnswerBox"
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
</td>
</tr>
</table>
</fieldset>
<p class="submitButton">
<asp:Button ID="CreateProfileButton" runat="server" CommandName="MoveNext" Text="Vytvořit účet"
ValidationGroup="RegisterUserValidationGroup"/>
</p>
</asp:WizardStep>
</WizardSteps>
</asp:CreateUserWizard>
</div>
<div class="foot">
</div>
</div>
<!-- END RIGHT BOX -->
SQL Dotaz
CREATE TABLE dbo.Users (
UserId int IDENTITY(1,1) NOT NULL,
UserName varchar(100) NOT NULL,
PasswordHash char(86) NOT NULL,
PasswordSalt char(5) NOT NULL,
Email varchar(100) NOT NULL,
Comment text NULL,
Enabled bit NOT NULL,
DateCreated datetime NOT NULL,
DateLastLogin datetime NULL,
DateLastActivity datetime NULL,
DateLastPasswordChange datetime NOT NULL,
CONSTRAINT PK_Users PRIMARY KEY CLUSTERED (UserId ASC),
CONSTRAINT IX_Users_UserName UNIQUE NONCLUSTERED (UserName ASC),
)
CREATE TABLE dbo.[Profiles] (
[ProfileId] int IDENTITY(1,1) NOT NULL,
[UserName] nvarchar(100) NOT NULL,
[LastUpdate] datetime NOT NULL,
[FirstName] nvarchar(max) NOT NULL,
[LastName] nvarchar(max) NOT NULL,
[CompanyName] nvarchar(max) NULL,
[Avatar] image NULL,
[Street] nvarchar(max) NOT NULL,
[HouseNumber] nvarchar(max) NOT NULL,
[Adress] nvarchar(max) NOT NULL,
[PostalCode] nvarchar(max) NOT NULL,
[TelNumber] nvarchar(max) NULL,
[FaxNumber] nvarchar(max) NULL,
[MobilNumber] nvarchar(max) NOT NULL,
[IcqNumber] nvarchar(9) NULL,
[SkypeName] nvarchar(max) NULL,
[Jabber] nvarchar(max) NULL,
[Country] int NOT NULL,
[Question] int NOT NULL,
[Answer] nvarchar(max) NOT NULL,
CONSTRAINT PK_Profiles PRIMARY KEY CLUSTERED (ProfileId ASC),
CONSTRAINT FK_Profiles_States FOREIGN KEY (Country)
REFERENCES dbo.States (IdState) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT FK_Profiles_Questions FOREIGN KEY (Question)
REFERENCES dbo.Questions (IdQuestion) ON UPDATE CASCADE ON DELETE CASCADE
)
Web.Config
<profile enabled="true" automaticSaveEnabled="false" defaultProvider="MyProfileProvider">
<providers>
<clear />
<add name="MyProfileProvider"
type="Altairis.Web.Security.SimpleSqlProfileProvider, Altairis.Web.Security"
connectionStringName="MainPages"
tableName="Profiles"
keyColumnName="UserName"
lastUpdateColumnName="LastUpdate" />
</providers>
<properties>
<add name="FirstName" type="String" defaultValue="Jméno" customProviderData="FirstName;nvarchar;max"/>
<add name="LastName" type="String" defaultValue="Příjmení" customProviderData="LastName;nvarchar;max"/>
<add name="CompanyName" type="String" defaultValue="" customProviderData="CompanyName;nvarchar;max"/>
<add name="Avatar" type="Byte[]" defaultValue="" customProviderData="Avatar;image"/>
<add name="Street" type="String" defaultValue="Ulice" customProviderData="Street;nvarchar;max"/>
<add name="HouseNumber" type="String" defaultValue="Číslo popisné" customProviderData="HouseNumber;nvarchar;max"/>
<add name="Adress" type="String" defaultValue="Město" customProviderData="Adress;nvarchar;max"/>
<add name="PostalCode" type="String" defaultValue="PSČ" customProviderData="PostalCode;nvarchar;max"/>
<add name="TelNumber" type="String" defaultValue="" customProviderData="TelNumber;nvarchar;max"/>
<add name="FaxNumber" type="String" defaultValue="" customProviderData="FaxNumber;nvarchar;max"/>
<add name="MobilNumber" type="String" defaultValue="Mobil" customProviderData="MobilNumber;nvarchar;max"/>
<add name="IcqNumber" type="String" defaultValue="" customProviderData="IcqNumber;nvarchar;9"/>
<add name="SkypeName" type="String" defaultValue="" customProviderData="SkypeName;nvarchar;max"/>
<add name="Jabber" type="String" defaultValue="" customProviderData="Jabber;nvarchar;max"/>
<add name="Country" type="Int" defaultValue="Země původu" customProviderData="Country;int"/>
<add name="Question" type="Int" defaultValue="Otázka" customProviderData="Question;int"/>
<add name="Answer" type="String" defaultValue="Odpověď" customProviderData="Answer;nvarchar;max"/>
</properties>
</profile>
Ťeť mám akorát ten problém že když dám u 1 kroku vytvořit účet tak nevím jak to udělat aby to přešlo na 2 krok, co mám nastavit do CommandName u
<asp:Button ID="CreateUserButton" runat="server" CommandName="MoveNext" Text="Vytvořit účet" ValidationGroup="RegisterUserValidationGroup"/>
|