1.设置一个button,点击他就关闭页面:
一般情况下是用JS来做处理,在ASP中还有一种处理方法:
    protected void Page_Load(object sender, EventArgs e)
    {
        closeButton.Attributes.Add("onclick", "window.close();");
    }

该功能是在后台为closeButton加一个Attributes,建值对为:("onclick", "window.close();")

2.asp中request和response得用法:

protected void Page_Load(object sender, EventArgs e)
    {
       //此方法无论From表单得method是post还是get都可以用这个来处理
        string userName = Request["txtUserName"].ToString();
      string userPwd = Request["txtPassword"].ToString();

//下列方法必须是在From表单得method是post得时候才能用此处理
        string userName = Request.Form.Get("txtUserName").ToString();
        string userPwd = Request.Form.Get("txtPassword").ToString();

        if (userName == "123" && userPwd == "123")
        {
          //重定向
            Response.Redirect("mainframe.aspx");

        }
        else
        {
            Response.Redirect("login.htm");
        }
       //直接写到页面上去

        //Response.Write("the usernsme is " + userName +"password is " + userPwd);
    }

3数据库的连接:(SQLSERVER2000)

       string userName = Request["txtUserName"].ToString();
       string userPwd = Request["txtPassword"].ToString();
          
        //Windows 验证模式对应的ConnectionString 属性设置:
       SqlConnection conn = new SqlConnection("Data Source=localhost;Initial Catalog =login; Integrated Security =True");

       //Sql Server  验证模式对应的ConnectionString 属性设置:
        //创建连接 字符串 :server=.服务器为本机

       //SqlConnection conn = new SqlConnection("server=.;database=login;uid=carmenl;pwd=Mi123456;");
        conn.Open();
        SqlCommand cmd = new SqlCommand("select count(*) from login where userName ='" + userName + "' and userPwd = '"+userPwd+"'",conn);
        //cmd.ExecuteScalar:返回首行首列,是一个object
        int count = Convert.ToInt32(cmd.ExecuteScalar());