中國文字博大精深,所以連Cookie存取都要先編碼((咦
HttpContext context = HttpContext.Current;
HttpCookie acookie = new HttpCookie("admin");
acookie.Values["uname"] = HttpUtility.UrlEncode("中文");//編碼
context.Response.AppendCookie(acookie);
HttpCookie aCookie = context.Request.Cookies["admin"];
HttpUtility.UrlDecode(aCookie.Values["uname"]).ToString()//解碼
沒有留言:
張貼留言