cookie(C#)用法

xiaoxiao2022-12-05  219

protected void Button1_Click(object sender, EventArgs e) { HttpCookie cookie = new HttpCookie("name", TextBox1.Text); cookie.Expires = DateTime.Now + new TimeSpan(0, 0, 5, 0); Response.Cookies.Add(cookie); }protected void Page_Load(object sender, EventArgs e) { HttpCookie co = Request.Cookies["cookie"]; Label1.Text = co.Value; }

相关资源:在C#中可以使用CookieContainer 对象来保存登录后的Cookie信息
转载请注明原文地址: https://www.6miu.com/read-4979292.html

最新回复(0)