web开发中经常涉及到页面传值的问题,目前我实践过的有2种方法。
一 通过session传:
WebForm1.aspx
Session["str"] = "hello world.";
Response.Redirect("WebForm2.aspx");
WebForm2.asp
this.label.Text = Session["str"].ToString();
二 通过Response传 用Request取值
WebForm1.aspx
String Message = Server.UrlEncode("欢迎学习ASP.NET!");
Response.Redirect("WebForm2.aspx?Msg=" + Message);
WebForm2.asp
this.Label1.Text = Server.UrlDecode(Request.QueryString["Msg"]);