예제 #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);
        }
예제 #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);
        }
예제 #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;
        }