CookieCollection TmpCC = wr.Cookies;
 GetCookie.Add(TmpCC);
我知道 TMPCC里面有一个实例
但是添加过去的时候
发现GETCOOKIE里面实例为0
如何解决

解决方案 »

  1.   

    system.windows下的静态方法
    public static string GetCookie(
    Uri uri
    )
      

  2.   

    GETCOOKIE Add实例为null吧
    那就是赋值的时候错误,先判断wr.Cookies返回值是否是null喽,不为null再赋值
      

  3.   

    HttpCookie hc=new HttpCookie("kingdom_0");
                HttpCookieCollection hcc = new HttpCookieCollection();
                hcc.Add(hc);
                HttpCookie testhc= hcc.Get(0);
                string str = testhc.Name;
                Response.Write(str);
      

  4.   


    HttpCookie hc = new HttpCookie("userCookie");
    hc["lastTime"] = DateTime.Now.ToString();
    hc["userName"] = "Admin";
    Response.Cookie.Add(hc);