日期:2014-05-17 浏览次数:20429 次
public static void SaveCartCookie(Ty_Cart cart)
{
string cookieKey = "cart_" + cart.C_u_id + "_" + cart.C_p_id;
HttpCookie cookie = new HttpCookie(cookieKey);
cookie["c_id"] = cart.C_id;
cookie["c_u_id"] = cart.C_u_id;
cookie["c_p_id"] = cart.C_p_id;
cookie["c_p_qty"] = cart.C_p_qty.ToString();
cookie["p_price"] = cart.P_price.ToString();
cookie["p_image"] = cart.P_image;
cookie["p_title"] = cart.P_title;
//设置cookie过期时间
cookie.Expires = DateTime.Now.AddDays(2);
HttpContext.Current.Response.Cookies.Add(cookie);
}
HttpContext.Current.Request.Cookies.Count