protected void Page_Load(object sender, EventArgs e)
{
//判断COOKIES集合是否为空
if (Response.Cookies["Logins"]!= null)
{
this.TextBox1.Text = Response.Cookies["Logins"]["mbid"].ToString();
this.TextBox2.Text = Response.Cookies["Logins"]["mbcode"].ToString();
this.TextBox3.Text = Response.Cookies["Logins"]["mbpoint"].ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{ HttpCookie cookie = new HttpCookie("Logins");
cookie.Values.Add("mbid", this.TextBox1.Text);
cookie.Values.Add("mbcode", this.TextBox2.Text);
cookie.Values.Add("mbpoint", this.TextBox3.Text);
//设置过期时间
cookie.Expires = DateTime.Now.AddDays(1);
Response.Cookies.Add(cookie);
Response.Write(Response.Cookies["Logins"]["mbid"].ToString());
}那里错了?
{
//判断COOKIES集合是否为空
if (Response.Cookies["Logins"]!= null)
{
this.TextBox1.Text = Response.Cookies["Logins"]["mbid"].ToString();
this.TextBox2.Text = Response.Cookies["Logins"]["mbcode"].ToString();
this.TextBox3.Text = Response.Cookies["Logins"]["mbpoint"].ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{ HttpCookie cookie = new HttpCookie("Logins");
cookie.Values.Add("mbid", this.TextBox1.Text);
cookie.Values.Add("mbcode", this.TextBox2.Text);
cookie.Values.Add("mbpoint", this.TextBox3.Text);
//设置过期时间
cookie.Expires = DateTime.Now.AddDays(1);
Response.Cookies.Add(cookie);
Response.Write(Response.Cookies["Logins"]["mbid"].ToString());
}那里错了?
if(Request.Cookies["userInfo"] != null)
{
Label1.Text =
Server.HtmlEncode(Request.Cookies["userInfo"]["userName"]); Label2.Text =
Server.HtmlEncode(Request.Cookies["userInfo"]["lastVisit"]);
}
{
this.TextBox1.Text = Request.Cookies["Logins"]["mbid"].ToString();
this.TextBox2.Text = Request.Cookies["Logins"]["mbcode"].ToString();
this.TextBox3.Text = Request.Cookies["Logins"]["mbpoint"].ToString();
}