zoukankan      html  css  js  c++  java
  • asp.net cookie

       HttpCookie ck = Request.Cookies["cktest"];
                
    if (ck == null)
                
    {
                    ck 
    = new HttpCookie("cktest");
                    ck.Value 
    = "123";

                    ck.Expires 
    = DateTime.Now.AddSeconds(20);//20秒的有效期
                    Response.Cookies.Add(ck);
                    Response.Write(
    "new ck");
                }

                
    else
                
    {
                    Response.Write(ck.Value.ToString());
                }


                
    //在一个Cookie中储存多个信息
                /*
                HttpCookie cookie = new HttpCookie("cktest");
                cookie.Values.Add("v1","1");
                cookie.Values.Add("v2","2");
                cookie.Values.Add("v3","3");
                Response.AppendCookie(cookie);


                HttpCookie cookies = Request.Cookies["cktest"];
                string value1 = cookies.Values["v1"];
                string value2 = cookies.Values["v2"];

                Response.Write(value1 + value2);

                
    */
  • 相关阅读:
    发呆发呆发呆发呆发呆发呆发
    大众捷达看想吃 v 觉得分开才相聚离开都出现
    yjggj
    test4
    test3
    test2
    test1
    Java并发之线程池ThreadPoolExecutor源码分析学习
    Java并发之AQS同步器学习
    ThreadLocal和ThreadLocalMap源码分析
  • 原文地址:https://www.cnblogs.com/ahuo/p/1046868.html
Copyright © 2011-2022 走看看