Ejemplo n.º 1
0
        /// <summary>
        /// 获取Session
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static object Get(Enumer.Session key)
        {
            string name    = key.ToString();
            var    context = HttpContext.Current;

            if (context != null && context.Session != null)
            {
                return(HttpContext.Current.Session[name]);
            }
            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 移除Session
        /// </summary>
        /// <param name="sessionKey"></param>
        public static void Remove(Enumer.Session sessionKey)
        {
            string key = sessionKey.ToString();

            HttpContext.Current.Session.Remove(key);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 保存用户Session
        /// </summary>
        /// <param name="sessionKey"></param>
        /// <param name="data"></param>
        public static void Set(Enumer.Session sessionKey, object data)
        {
            string key = sessionKey.ToString();

            HttpContext.Current.Session[key] = data;
        }