示例#1
0
文件: B_Admin.cs 项目: baixue001/IPS
        /// <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));
            }
        }