Viewing source for recipe0804cs.aspx
<%@ Page %>
<script language="C#" runat="server">
private void Login_Click(object sender, System.EventArgs e)
{
if (UserName.Text=="johndoe" && Password.Text=="password")
{
System.Web.Security.FormsAuthentication.RedirectFromLoginPage(UserName.Text, false);
}
else
{
Message.Text="Invalid Username/Password combination";
}
}
</script>
<HTML>
<HEAD>
<title>You want to create a login form for your web application using Forms
Authentication.</title>
</HEAD>
<body>
<form id="recipe0804cs" method="post" runat="server">
<p align="center">
<table cellpadding="2" cellspacing="0" bgcolor="#fafade">
<tr>
<th colspan="2" bgcolor="#baba99">
Login</th>
</tr>
<tr>
<td>User Name:</td>
<td><asp:TextBox ID="UserName" Runat="server" /></td>
</tr>
<tr>
<td>Password:</td>
<td><asp:TextBox ID="Password" Runat="server" TextMode="Password" /></td>
</tr>
<tr>
<td colspan="2" align="middle"><asp:Button ID="Login" Text="Login" Runat="server" OnClick="Login_Click"/></td>
</tr>
</table>
<br>
<asp:Label ID="Message" Runat="server" ForeColor="#FF0000"></asp:Label>
</p>
</form>
</body>
</HTML>