System.Text.Encoding  enc = System.Text.Encoding.GetEncoding("GB2312");
Request.Cookies["YourCookieName"].Value = HttpUtility.UrlEncode("汉字", enc);

解决方案 »

  1.   

    老大,这好像是从ASP.NET中读取ASP中的Cookies值的解决方法吧!
      

  2.   

    >>>从ASP.NET中读取ASP中的Cookies值的解决方法System.Text.Encoding  enc = System.Text.Encoding.GetEncoding("GB2312");
    string s = HttpUtility.UrlDecode(Request.Cookies["YourCookieName"].Value, enc)
      

  3.   

    在asp.net中
    System.Text.Encoding  enc = System.Text.Encoding.GetEncoding("GB2312");
    HttpCookie cookie=new HttpCookie("YourCookieName");
    string ss = HttpUtility.UrlEncode("也是中文嘛",enc);
    cookie.Values.Add("user_name", ss);
    System.Web.HttpContext.Current.Response.AppendCookie(cookie);在asp中
    <%=Request.Cookies("YourCookieName")("user_name")%>
    方法类同思归都是先对string进行编码。
      

  4.   

    为什么你会不行呢?
    做个测试先。
    1新建一个asp页面在body里写上<%=Request.Cookies("YourCookieName")("user_name")%>
    2新建一个asp.net页面在Page_Load里写上
    System.Text.Encoding  enc = System.Text.Encoding.GetEncoding("GB2312");
    HttpCookie cookie=new HttpCookie("YourCookieName");
    string ss = HttpUtility.UrlEncode("也是中文嘛",enc);
    cookie.Values.Add("user_name", ss);
    System.Web.HttpContext.Current.Response.AppendCookie(cookie);
    3在该asp.net页面中加上到那个asp页面的链接
    4生成并浏览该asp.net页面
    5点击里面的链接,你应该就会被链到那个asp页面并且将看到"也是中文嘛"这句话。