QueryString属性:例:页面1:<a href="页面2.aspx?uanme=王华&uage=18">提交</a> //通过get方式传值
页面2:protected void Page_Load(object sender, EventArgs e){
string uname, uage;
uname = Request.QueryString["uname"];
uage = Request.QueryString["uage"];
Label1.Text = uname + "您好,您的年龄是:" +uage + "岁";
}
Form属性传递数据:例:页面1:<form id="form1" method="post" action="Default2"> //提交到Default2
<div><input id="Submit1" type="submit" value="提交"/><br />
<input id="Hidden1" name="uname" value=""/>
<input id="Hidden2" name="uage" value=""/>
</div>
</form>
页面2:protected void Page_Load(object sender, EventArgs e){
string uname, uage;
var res = Request.Form;
uname = res["uanme"];
uage = res["uage"];
//uname = Request.Form["uname"];
//uage = Request.Form["uage"];
Label1.Text = uname + "您好,您的年龄是:" +uage + "岁";
}