Ejemplo n.º 1
0
        public object Get(string key)
        {
            if (!SessionStorage.ContainsKey(SessionId))
            {
                return(null);
            }
            //存在的情况下, 先找用户盒子
            IDictionary <string, object> temp = SessionStorage[SessionId];

            if (!temp.ContainsKey(key))
            {
                return(null);
            }
            return(temp[key]);
        }
Ejemplo n.º 2
0
        public void Set(string key, object value)
        {
            IDictionary <string, object> temp = new Dictionary <string, object>();

            if (SessionStorage.ContainsKey(SessionId))
            {//当前session中已经存在
                temp = SessionStorage[SessionId];
                if (temp.ContainsKey(key))
                {
                    temp[key] = value;
                }
                else
                {
                    temp.Add(key, value);
                }
            }
            else
            {//session中 没有当前盒子
                temp.Add(key, value);
                SessionStorage.Add(SessionId, temp);
            }
        }