Beispiel #1
0
        public static T GetValue(string Key)
        {
            Key = "OBJ_" + Key;

            T t = default(T);

            if (!Cookies.Exists(Key))
            {
                return(t);
            }

            try
            {
                string       s        = Cookies.GetValue(Key, true);
                byte[]       arrBytes = Convert.FromBase64String(s);
                MemoryStream stream   = new MemoryStream();
                stream.Write(arrBytes, 0, arrBytes.Length);
                stream.Seek(0, SeekOrigin.Begin);
                //BinaryFormatter format = new BinaryFormatter();
                XmlSerializer format = new XmlSerializer(typeof(T));
                t = (T)format.Deserialize(stream);
                stream.Close();
            }
            catch
            {
                Cookies.Remove(Key);
            }

            return(t);
        }
Beispiel #2
0
 public static void Logout()
 {
     Cookies.Remove("CP.UserID");
 }
Beispiel #3
0
        public static void Remove(string Key)
        {
            Key = "OBJ_" + Key;

            Cookies.Remove(Key);
        }
Beispiel #4
0
 public static void Logout()
 {
     Cookies.Remove("Web.Login");
 }
Beispiel #5
0
 public static void LogoutOnWeb()
 {
     Cookies.Remove("CP.UserIDOnWeb");
 }