点按钮写Cookie,关闭再打开,居然不显示啊,高人指点,是写错了还是读错了
protected void Page_Load(object sender, EventArgs e)
{
try
{
HttpCookie hc1 = new HttpCookie("HYTTBZPT1"); TextBox1.Text = hc1.Values["UserName"].ToString();
TextBox2.Text = hc1.Values["PassWord"].ToString();
}
catch { }
//}
}protected void Button1_Click(object sender, EventArgs e)
{
if (this.CheckBox1.Checked==true)
{
HttpCookie hc1 = new HttpCookie("HYTTBZPT1");
hc1.Expires.AddYears(10);
hc1["UserName"] = TextBox1.Text.ToString();
hc1["PassWord"] = TextBox2.Text.ToString();
this.Response.AppendCookie(hc1); }
}
protected void Page_Load(object sender, EventArgs e)
{
try
{
HttpCookie hc1 = new HttpCookie("HYTTBZPT1"); TextBox1.Text = hc1.Values["UserName"].ToString();
TextBox2.Text = hc1.Values["PassWord"].ToString();
}
catch { }
//}
}protected void Button1_Click(object sender, EventArgs e)
{
if (this.CheckBox1.Checked==true)
{
HttpCookie hc1 = new HttpCookie("HYTTBZPT1");
hc1.Expires.AddYears(10);
hc1["UserName"] = TextBox1.Text.ToString();
hc1["PassWord"] = TextBox2.Text.ToString();
this.Response.AppendCookie(hc1); }
}
解决方案 »
- HyperLinker传多个参数值,怎么传
- 关于gridview用代码加入一列的问题,高手请进!!!
- .net发送邮件问题,本地调试发送正常,传到空间就不对了
- 在Form窗体中用DataGridView控件显示数据的问题
- 高手进:datagrid的网格是否可以拆分,像EXCEL里的"单元格拆分"一样?
- 如何获取系统的输入法
- 为什么vs2005中的gridview没有“auto edit”“auto delete”“auto updata”选项呢?
- 请问怎么格式化ntext字段的内容呢?
- VB转C#问题
- 如何从内存销毁一个静态对象?
- URL地址重写(网址) asp.net
- fromview怎么没法更新啊
Response.Cookies.Add(myCookie); //read
Request.Cookies["cookies名称"];
Response.cookie.add(mycookie); //写入cookie
mycookie.value=值;
Request.Cookies["名"].value.Tostring(); //读出来