Пример #1
0
        public static bool CheckSignin(HttpContext context)
        {
            T cu = Current;

            if (cu == null)
            {
                HttpCookie hc = context.Request.Cookies["SInfo"];
                if (hc == null)
                {
                    return(false);
                }
                string username  = hc.Values[".b"];
                string password  = hc.Values[".a"];
                string s_expires = hc.Values[".c"];
                if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
                {
                    return(false);
                }
                username = CryptUtils.DecryptDES(username);
                password = CryptUtils.DecryptDES(password);
                DateTime?expires = null;
                if (!string.IsNullOrEmpty(s_expires))
                {
                    try
                    {
                        expires = DateTime.Parse(s_expires);
                    }
                    catch { }
                }
                return(TrySignin(username, password, expires, context));
            }
            else
            {
                return(true);
            }
        }