页面一
publicstring name
{
get
{
returnthis.TextBox1.Text;
}
}
publicstring EMail
{
get
{
returnthis.TextBox2.Text;
}
}
protectedvoid Button1_Click(object sender, EventArgs e)
{
Context.Items.Add("name", name);
Context.Items.Add("EMail", EMail);
Server.Transfer("WebForm2.aspx");
}
{
get
{
returnthis.TextBox1.Text;
}
}
publicstring EMail
{
get
{
returnthis.TextBox2.Text;
}
}
protectedvoid Button1_Click(object sender, EventArgs e)
{
Context.Items.Add("name", name);
Context.Items.Add("EMail", EMail);
Server.Transfer("WebForm2.aspx");
}
跳转后的页面
Response.Write(Context.Items["name"].ToString() + Context.Items["EMail"].ToString());
2:cs端返回上一页
获取页面地址存入ViewState
步骤一: ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
步骤二: Response.Redirect((String)ViewState["UrlReferrer"]);