会话问题. [英] Problem with session.

查看:45
本文介绍了会话问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我做了一个命名为购物车"的会议.现在,每当用户将商品添加到购物车应用程序时,都会检查会话"Cart"是否为null.如果为null,则创建会话;否则,创建会话.
我面临的问题是,如果同时有两个用户打开该应用程序,并且一个人向其购物车添加了商品,则该商品也会在其他用户的购物车中显示.

我该怎么做才能消除此错误?这很紧急...:''(

Hi all!!

i have made a session naming "Cart". now whenever a user adds item to cart application checks the whether the session "Cart" is null or not . if null it creates the session if not it adds items to the session.
The problem that i am facing is that if simultaneously two user open the application and one adds item to it''s cart the item also gets shown in the other users cart.

what should i do to remove this error ?? it''s urgent... :''(

推荐答案

一个猜测(并且没有我能做的所有代码),您正在创建自己的会话,大概是文件或数据库的一部分.

不要.
使用实际的Session对象,或者(如果可能的话)使用cookie.

两种方式都特定于用户PC或连接,并将其与其他用户隔离.
At a guess (and without code that is all I can do) you are creating your own sessions, presumably as a file, or part of a database.

Don''t.
Use either the actual Session object, or (better if you can) cookies.

Either way is specific to the user PC or connection and will isolate him from other users


hai ujjwal,

是会话状态或复制状态bcos特定的会话状态仅适用于该用户,而不适用于所有用户
hai ujjwal,

is that session state or aplication state bcos particular session state is avaiable only for that user not for all


这篇关于会话问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆