在.NET中页面之间的参数传递有多种方法:
session:存储在服务器中
![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
//原始页page1.apsx
protected void Button1_Click(object sender, EventArgs e)
{
Session["name"] = textbox1.Text;
Response.Redirect("page2.aspx");
}
//目标页page2.aspx
public partial class page2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//输出传递的参数到label控件中
Label1.Text = "输入" + Session["name"].ToString() + "组数";
//输出参数到textbox控件中
this.TextBox1.Text = "输入" + Session["name"].ToString() + "组数";
}
}
cookie:存储在客户端中
Response.Redirect("")
Application
Server.Transfer
在ASP.NET2.0+中还有跨网页公布(Cross-Page Posting)