Example #1
0
 public void SetSession(USR_CustomerMod m_user)
 {
     SessionInfo m_session = new SessionInfo();
     m_session.CustomerEntity = m_user;
     m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo);
     Session[AppConfig.CustomerSession] = m_session;
 }
Example #2
0
 public SessionInfo GetSession()
 {
     SessionInfo oSession = (SessionInfo)Session[AppConfig.CustomerSession];
     if (oSession == null)
     {
         oSession = new SessionInfo();
         Session[AppConfig.CustomerSession] = oSession;
     }
     return oSession;
 }
Example #3
0
        protected void Unnamed2_Click(object sender, EventArgs e)
        {
            string username = txtEmail.Text.Trim();
            string password = txtPass.Text.Trim();
            #region 验证邮箱有效性
            #endregion

            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username, password);
            if (m_user.SysNo != AppConst.IntNull)//COOKIES验证成功
            {
                SessionInfo m_session = new SessionInfo();
                m_session.CustomerEntity = m_user;
                m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                Session[AppConfig.CustomerSession] = m_session;
                //记住我
                if (chkRemember.Checked)
                {
                    HttpCookie Cookie = CookiesHelper.GetCookie("upup1000");
                    if (Cookie == null || Cookie.Value == null || Cookie.Value == "")
                    {
                        Cookie = new HttpCookie("upup1000");
                        Cookie.Values.Add("uname", CommonTools.Encode(username));
                        Cookie.Values.Add("psd", CommonTools.Encode(password));
                        //设置Cookie过期时间
                        Cookie.Expires = DateTime.Now.AddYears(50);
                        CookiesHelper.AddCookie(Cookie);
                    }
                    else
                    {
                        CookiesHelper.SetCookie("upup1000", "uname", CommonTools.Encode(username), DateTime.Now.AddYears(50));
                        CookiesHelper.SetCookie("upup1000", "psd", CommonTools.Encode(password), DateTime.Now.AddYears(50));
                    }
                }
                LogManagement.getInstance().WriteTrace("前台会员登录", "Login", "IP:" + Request.UserHostAddress + "|AdminID:" + m_session.CustomerEntity.Email);
                //跳转
                Response.Redirect("Qin/View/" + m_user.SysNo);
            }
            else
            {
                Response.Redirect("Passport/Login.aspx?email=" + txtEmail.Text.Trim() + "&error=" + (int)AppEnum.ErrorType.WrongAccount);
            }
        }