Пример #1
0
        public static void Signin(T user, DateTime?expires, HttpContext context)
        {
            if (SigningIn != null)
            {
                UserStatusEventArgs e = new UserStatusEventArgs(context, false);
                SigningIn(user, e);
                if (e.Cancel)
                {
                    return;
                }
            }
            (user as UserBase <T>).IP = WebUtils.GetClientIP(context);
            HttpCookie hc = new HttpCookie("SInfo");

            hc.Values.Add(".b", CryptUtils.EncryptDES((user as UserBase <T>).UserName));
            hc.Values.Add(".a", CryptUtils.EncryptDES((user as UserBase <T>).Password));
            if (expires != null)
            {
                hc.Values.Add(".c", expires.ToString());
                hc.Expires = (DateTime)expires;
            }
            context.Response.Cookies.Set(hc);
            context.Session["Burst.Web.UserBase.Current"] = user;
            if (SignedIn != null)
            {
                SignedIn(user, new UserStatusEventArgs(context, false));
            }
        }