cookies小结1.cookie 将信息保存在客户端。session和application 保存在服务器端 2.cookie有两类:会话cookie(暂时性,保存在游览其中)持久性cookie保存在客户端 会话cookie创建:Httpcookie cook = new Httpcookie(名字,值); 取值:Response.Write(Response.Cookies[名字].Value); 持久性cookie创建:Httpcookie cook = new Httpcookie(名字,值); 缺点:保存在客户端,不安全 //创建cookie HttpCookie cook = new HttpCookie("Username"); cook.value = "张三"; Response.Cookies.Add(cook); // 提取cookie string c = Request.Cookies["Username"].value; Response.Write(c); |
|