Exemplo n.º 1
0
        /// <summary>
        /// admin must safe exit ervery time or cookie live just in brower
        /// </summary>
        public static M_AdminInfo GetLogin(HttpContext ctx)
        {
            string sname = "";

            try
            {
                sname = ctx.Session.GetString(prefix + "name");
            }
            catch { }
            if (string.IsNullOrEmpty(sname))
            {
                //从Cookies中重读
                string name = CookieHelper.Get(ctx, prefix + "name");
                string pwd  = CookieHelper.Get(ctx, prefix + "pwd");
                if (StrHelper.StrNullCheck(name, pwd))
                {
                    return(null);
                }
                return(B_Admin.AuthenticateAdmin(name, pwd));
            }
            else
            {
                return(GetAdminByAdminName(sname));
            }
        }