我是这样写的 :
//以下是存cookie, 假设这是些在controllerA中,运行项目首先会走过这段代码,也就是cookie里面现在是有值的。
HttpCookie cookie = new HttpCookie("xx");
xx.Name = "Name";
xx.Expires = DateTime.Today.AddDays(365);
xx.Values.Add("xx_Id", "Id");
Response.AppendCookie(cookie);
//以下是取cookie,假设是在controllerB中,运行完项目当我进行某一操作时,会走下面这段代码。 问题是 为什么现在的Request.Cookies["xx"] 是空的,???求解啊!!
if (Request.Cookies["xx"] != null) {
string X = Request.Cookies["xx"]["xx_Id"].ToString();}
慕标琳琳