Datasheet

Font-Names=”Verdana” Font-Size=”0.8em”
ForeColor=”#284775” />
<TextBoxStyle Font-Size=”0.8em” />
<TitleTextStyle BackColor=”#5D7B9D” Font-Bold=”True” Font-
Size=”0.9em” ForeColor=”White” />
<InstructionTextStyle Font-Italic=”True” ForeColor=”Black”
/>
</asp:Login>
Important attributes to note are DestinationPageUrl, which determines where the user is navigated to
if he or she enters a valid username and password. In the Online Diary project it’s the Diarymain.aspx
page, the center of the Online Diary’s interface.
To enable new users to register, the
CreateUserText has been set to a friendly “register here” message;
the URL for registering is specified in
CreateUserUrl.
Finally, just in case the user has already registered but forgotten his or her password, the
PasswordRecoveryText attribute displays a “Forgotten your password?” message and
PasswordRecoveryUrl sets the URL the users are navigated to if they need to find out their password.
The only code you need to write is in the
Login control’s LoggedIn event, which fires if the user suc-
cessfully enters a username and password:
Protected Sub Login1_LoggedIn(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Login1.LoggedIn
Dim DiaryId As Integer = GetDiaryIdFromUserName(Login1.UserName)
Session(“DiaryId”) = DiaryId
End Sub
This uses the supplied username to look up the user’s DiaryId in the Online Diary database. This is
then stored in the session variable.
The SignOn.aspx page also allows new users to register.
New User Registration
The RegisterStart.aspx. page deals with the registration of a new user. As with SignOn.aspx, this page
also uses one of the new
Login controls, this time the CreateUserWizard control. The markup for the
CreateUserWizard control is shown in the following code:
<asp:CreateUserWizard ID=”CreateUserWizard1” runat=”server”
BackColor=”#F7F6F3” BorderColor=”#E6E2D8”
BorderStyle=”Solid” BorderWidth=”1px” Font-Names=”Verdana” Font-
Size=”0.8em”
Style=”z-index: 100; left: 66px; position: absolute; top: 43px”
Height=”164px” Width=”300px” FinishDestinationPageUrl=”~/SignOn.aspx”>
<SideBarStyle BackColor=”#5D7B9D” BorderWidth=”0px” Font-Size=”0.9em”
VerticalAlign=”Top” />
<SideBarButtonStyle BorderWidth=”0px” Font-Names=”Verdana”
ForeColor=”White” />
19
The Online Diary and Organizer
04_749516 ch01.qxp 2/10/06 9:11 PM Page 19