示例#1
0
 public void Remove(SessionEnum key)
 {
     if (HttpContext.Current.Session[key.ToString()] != null)
     {
         HttpContext.Current.Session.Remove(key.ToString());
     }
 }
        public static void Remove(SessionEnum key)
        {
            if (HttpContext.Current.Session == null || HttpContext.Current.Session[key.ToString()] == null)
            {
                return;
            }

            HttpContext.Current.Session.Remove(key.ToString());
        }
        public static void SetSessionObject(SessionEnum key, object value)
        {
            if (HttpContext.Current.Session[key.ToString()] != null)
            {
                Remove(key);
            }

            HttpContext.Current.Session.Add(key.ToString(), value);
        }
 public static object GetSessionObject(SessionEnum key)
 {
     if (HttpContext.Current == null || HttpContext.Current.Session == null || HttpContext.Current.Session[key.ToString()] == null)
     {
         return(null);
     }
     return(HttpContext.Current.Session[key.ToString()]);
 }
示例#5
0
        public T Get <T>(SessionEnum key) where T : class
        {
            if (HttpContext.Current.Session != null)
            {
                object RetObject = HttpContext.Current.Session[key.ToString()];
                if (RetObject != null)
                {
                    return((T)RetObject);
                }
            }


            return(null);
        }
示例#6
0
 public void Set(object obj, SessionEnum key)
 {
     HttpContext.Current.Session[key.ToString()] = obj;
 }
示例#7
0
 public object Get(SessionEnum key)
 {
     return(HttpContext.Current.Session[key.ToString()]);
 }