我在asp 登录的时候  写入cookies   如下代码段      Response.Cookies("U_PQAZEDCd")=yourname'/写入一个cookie
                Response.Cookies("U_PQAZEDCd").Expires=Date+720asp.net  是这么接收cookies的  public string getCookiesValue()
        {
            HttpCookie username_htc = Request.Cookies["U_PQAZEDCd"];
            var getvalues = "";
            if (username_htc == null )
            {
                return "1";
            }
            else
            {
                getvalues = username_htc.Value;
            }
            return getvalues;
        }返回值 始终是1  也就是  cookies  就是null
 

解决方案 »

  1.   

    config 里面设置编码为 gb2312<globalization fileEncoding="gb2312" requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN"/>
      

  2.   

    asp和asp.net之间的Session是不能共享的。
    解决办法是:可以通过数据库,也可以通过WebService实现,不过这都很麻烦。Cookie共享简单的多。
    asp和asp.ne的Cookie只是存储的编码格式不同,经过简单转换就可以了。
    如果使用asp保存COOKIES则中文将保存成某种格式比如,“中国”保存成了:“%D6%D0%B9%FA” 。
    只需要在asp.net(c#)页面做处理。
    代码如下:
    //在ASP.Net中保存Cookie时:        System.Text.Encoding theEncoding = System.Text.Encoding.GetEncoding("gb2312");
            string cookieValue = HttpUtility.UrlEncode( "中国",theEncoding );
            Request.Cookies["SomeCookie"].Value = cookieValue;
    //获取Cookie时:
            System.Text.Encoding theEncoding = System.Text.Encoding.GetEncoding("gb2312");
            string cookieValue = Request.Cookies["SomeCookie"].Value;        string decodeValue = HttpUtility.UrlDecode(cookieValue, theEncoding);
      

  3.   

    不是编码的问题  asp 和asp.net 都是 utf-8 的编码     还有我ie 没有阻挡cookies 写入