Application["sum"]=this.TextBox1.Text;
Server.Transfer("WebForm2.aspx");
this.TextBox1.Text=(string)Application["sum"];
Application实质上是整个虚拟目录中所有文件的集合,如果想在整个应用范围内使用某个变量值,Application对象将是最佳的选择
{
string url;
url="webform2.aspx?name="+TextBox1.Text ;
Response.Redirect(url);
}
接收页:
{
Label1.Text=Request.QueryString["name"];
}
//Querystring是一种非常简单的传值方式,其缺点就是会把要传送的值显示在浏览器的地址栏中
{
Session["Name"]=TextBox1.Text;
Response.Redirect("webform2.aspx");
}
接收页:
{
Label1.Text=Session["Name"].ToString();
}