1

aspx TextBox1.Text World.aspx TextBox1.Text

我希望页面 Hello.aspx 和 World.aspx 具有相同的验证值

请帮助我任何人对此有想法

4

1 回答 1

1

您需要使用 cookie 或数据库或其他方式将值保存在第一页上。然后检索第二页中的值并比较验证函数或事件中的值。

using(SqlConnection cn = new SqlConnection(connStr))
    {


    using(SqlCommand cmd = new SqlCommand())
    {
        cmd.Connection = cn;

        string sql = string.Format(@"select email from customers where customer_id = '{0}'", customer_id);

        cmd.CommandType = CommandType.Text;

        //try and catch block would go here

        cmd.CommandText = sql;

        cn.Open();
        SqlDataReader rdr = cmd.ExecuteReader();
        string email = rdr[0].ToString();
        cn.Close();
    }
    }
于 2013-01-11T12:43:48.847 回答