同题目!
谢谢大家
在线等

解决方案 »

  1.   

    建议你看一下asp.net验证控件,很简单的。特别是比较验证控件:CompareValidator
      

  2.   

    这是一篇关于验证控件的文章:
    http://www.chinabs.net/aspnet/default.asp?infoid=75
      

  3.   

    查找有无该用户然后进行密码判断最后进行跳转工作
    最好不是赋予一个SESSION,然后再在每个页面进行判断一下
      

  4.   

    给你一个做参考 private void ButtonLogin_Click(object sender, System.EventArgs e)
    {
    if((this.TextBoxUserCode.Text=="")||(this.TextBoxUserPassword.Text=="")) 
    Page.RegisterStartupScript("check", "<script>alert('请正确输入用户和密码!');</script>");
    else
    {
    string strLogin = "select count(UserCode) from TS_User where UserCode='"+this.TextBoxUserCode.Text.Trim()+"' and Password='"+ this.TextBoxUserPassword.Text.Trim() + "'";
    this.sqlDataAdapter1.SelectCommand.CommandText =strLogin;
    this.sqlDataAdapter1.SelectCommand.Connection.Close();
    this.sqlDataAdapter1.SelectCommand.Connection.Open();
    int num = (int)this.sqlDataAdapter1.SelectCommand.ExecuteScalar();
    if (num>0)
    {
    this.Session.Clear();
                        this.Session["UserCode"] = TextBoxUserCode;
    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(this.Session["UserCode"].ToString(), true, 60);
    string EncTicket = FormsAuthentication.Encrypt(ticket);
    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, EncTicket));
    Response.Redirect("Default.aspx",false);
    }
    else
                        Page.RegisterStartupScript("check", "<script>alert('用户或者密码错误!');</script>");
    }
    }
      

  5.   

    上面参考的FormsAuthenticationTicket这个是什么东东?