几种ASP.NET页面之间传递值的方法
介绍ASP.NET页面之间值传递的几种方法,基本来的哦。
第一种方法:
通过URL链接地址传递
以下为引用的内容:
send.aspx: protected void Button1_Click(object sender, EventArgs e) { Request.Redirect("Default2.aspx?username=honge"); } receive.aspx: string username = Request.QueryString["username"]; 这样可以得到参数值。 |
第二种方法:
通过post方式。
以下为引用的内容: send.aspx receive.aspxstring username = Ruquest.Form["receive"]; |
第三种方法:
以下为引用的内容:
通过session protected void Button1_Click(object sender, EventArgs e) { Session["username"] = "honge"; Request.Redirect("Default2.aspx"); } receive.aspx: string username = Session["username"]; 这样可以得到参数值。 |
- 上一篇:VS2008设置查看.NET源码的方法
- 下一篇:.NET实现插件功能的接口程序