|
在后台页面能够读取cookie中全部数据了,但是想将UserID 和UserName值单独区分出来读取,但是菜鸟我不会将他们区分开来读取,- if (System.Web.HttpContext.Current.Request.Cookies["cookieUser"] != null)
- {
- try
- {
- string cookieValue = System.Web.HttpContext.Current.Request.Cookies["cookieUser"].Value.ToString();
- Encoding stre = Encoding.GetEncoding("UTF-8");
- string cookie = System.Web.HttpUtility.UrlDecode(cookieValue, stre);
- string idnum = JsonConvert.SerializeObject(cookie);//引用Newtonsoft.Json.dll文件
- JObject jObject = JObject.Parse(idnum);
-
- }
- catch (Exception ex)
- {
- throw(ex);
- }
- }
复制代码 这段代码,运行后抛异常
|
组图打开中,请稍候......
|