我正在开发购物车功能。我需要来自用于呈现购物车页面的服务器的产品数据。
每次点击 Add-to-cart 按钮时,我都会将此数组字符串化(使用 JSON.stringify() ):
var CART = [{productId: 102, quantity: 3} , {productId: 211, quantity: 6}];
我想Request.Cookie["shoppingCart"]在我的 ASP.NET 应用程序中使用这些数据,但是当我调试时它总是null
这是我打电话时浏览器返回的内容document.cookie
"shoppingCart=[{\"productId\":101617121,\"quantity\":2}]"
但是,当我尝试将 cookie 的值更改为类似的值时:shoppingCart=testresult,Request.Cookie["shoppingCart"]则具有价值。
预先感谢您帮助我!
