Dict.CN

cookie用法

        //写cookie
       //创建一个Cookie的实例
       HttpCookie cookie = new HttpCookie("username", username);
       //设置Cookie的超时时间
       cookie.Expires = System.DateTime.Now.AddMonths(1);
       //将Cookie写到客户端
       Response.Cookies.Add(cookie);

      //读Cookie
     HttpCookie userCookie = Request.Cookies["username"] ;
      //userCookie.Value;
    
       //移除cookie的方法
       userCookie .Values.Remove("ProductID");
       userCookie .Values.Clear();

    

posted on 2007-08-14 19:11  standas  阅读(154)  评论(0)    收藏  举报