<%@ Import Namespace="System.Web.Security " %>

<html>

  <script language="VB" runat=server>
    Sub Login_Click(Src As Object, E As EventArgs)
        
        If FormsAuthentication.Authenticate(UserName.Value, UserPass.Value)
    	    FormsAuthentication.RedirectFromLoginPage(UserName.Value,PersistCookie.Checked)
	 Else
            Msg.Text = "对不起，用户名或密码错误：请重新登录"
        End If
    End Sub  
  </script>

  <body>
    
    <form runat=server>
    
      <h3><font face="Verdana">登录页面</font></h3>

      <table>
        <tr>
          <td>用户名:</td>
          <td><input id="UserName" type="text" runat=server/></td>
          <td><ASP:RequiredFieldValidator ControlToValidate="UserName" Display="Static" ErrorMessage="*" runat=server/></td>
        </tr>
        <tr>	
          <td>密码:</td>
          <td><input id="UserPass" type=password runat=server/></td>
          <td><ASP:RequiredFieldValidator ControlToValidate="UserPass" Display="Static" ErrorMessage="*" runat=server/></td>
        </tr>
        <tr>
          <td>保存 Cookie:</td>
          <td><ASP:CheckBox id=PersistCookie runat="server" /> </td>
          <td></td>
        </tr>
      </table>
      
      <asp:button text="登录" OnClick="Login_Click" runat=server/>
      
      <p>
      
      <asp:Label id="Msg" ForeColor="red" Font-Name="Verdana" Font-Size="10" runat=server />

    </form>
  </body>

</html>

