码迷,mamicode.com
首页 > Web开发 > 详细

ASP三种常用传值方式:

时间:2015-08-13 17:51:57      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

ASP 页面(两个aspx页面)传值方式:
背景: 两个aspx 页面
valuepage.aspx tbusername tbpwd
obtainvalue.aspx tbusername tbpwd

1 使用QueryString方式:
valuespage.aspx值发送页面代码:
Response.Redirect("obtainvalue.aspx?username="+this.tbusername.text.trim()+"&pwd"+this.tbpwd.trim());
obtain.aspx接收值页面:
private void QueryString()
{
this.tbusername.text = request.queryString["username"];
this.tbpwd.text = request.querystring["pwd"];
}
2 使用Session传值:
valuespage.aspx 发送页面值:
Session["username"] = this.tbusername.text.trim();
Session["pwd"] = this.tbPwd.text.trim();
response.redirect("Obtainvalues.aspx");
obtainvalues.aspx接受页面:
this.tbusername.text = session["username"].tostring();
this.tbpwd.text =session["pwd"].tostring();

3 使用COOKIE变量传值:
发送页面
.aspx页面:
Response.Cookies["aaa"].Value = "hello world";
Response.Redirect("Default3.aspx");
接受页面:
.cs页面:
Label1.Text = Request.Cookies["aaa"].Value;

 

ASP三种常用传值方式:

标签:

原文地址:http://www.cnblogs.com/woniu-net/p/4727807.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!