C#]
<html>
<head>
<script language="C#" runat=server>
     void SubmitBtn_Click(Object Source, EventArgs E)
     {
          // Pull credentials from form fields and try to authenticate.
          if (FormsAuthentication.Authenticate(UserName.Value, 
                                            UserPassword.Value))
          {
               FormsAuthenticationTicket ticket = new 
                       FormsAuthenticationTicket(UserName.Value, false, 5000);
               FormsAuthentication.RedirectFromLoginPage(UserName.Value,
                                                  PersistForms.Checked);
          }
     }
</script>
</head><body><form method=post runat=server>
<table>
     <tr>
          <td>Name:</td>
          <td><input type="text" id="UserName" runat=server/>
     </tr>
     <tr>
          <td>Password:</td>
          <td><input type="password" id="UserPassword" runat=server/>
     </td>
</table>
<input type="checkbox" id="PersistForms" runat=server />Use persistent cookie
<br>
<input type="submit" OnServerClick="SubmitBtn_Click" runat=server />
</form>
</body>
</html>