Ejemplo n.º 1
0
        private bool LoadSession(string sesFile)
        {
            var prevSession = BookieSessionUni.Load(sesFile);

            if (prevSession == null)
            {
                return(false);
            }

            Logger.LogInformation("Session loaded for user: "******"www." + x.Domain)
            {
                Expires  = x.Expires,
                HttpOnly = x.HttpOnly,
                Path     = x.Path,
                Secure   = x.Secure,
                Version  = x.Version,
                // Port = x.Port
            }).ToList());

            return(true);
        }
Ejemplo n.º 2
0
        protected void SaveSession(string sesFile, IEnumerable <Uri> domains)
        {
            var cookies = new List <Cookie>();

            foreach (var domain in domains)
            {
                var sesCookies = _web.GetCookies(domain);
                cookies.AddRange(sesCookies.Cast <Cookie>());
            }

            var newSession = new BookieSessionUni
            {
                TimeStamp = DateTime.Now,
                User      = UserName,
                Cookies   = cookies.Select(x => new UniCookie(x.Name, x.Value, x.Domain, x.Expires, x.HttpOnly, x.Path, x.Secure, x.Version, x.Port)).ToList(),
            };

            BookieSessionUni.Save(newSession, sesFile);
            Logger.LogInformation("Session saved");
        }