Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                switch (UrlParamHelper.QueryString("type"))
                {
                case "0":
                    LoginSystem();
                    break;

                default:
                    break;
                }
            }
        }
Example #2
0
        void LoginSystem()
        {
            var userName = UrlParamHelper.QueryString("userName");
            var userPwd  = UrlParamHelper.QueryString("userPwd");

            if (userName.Length == 0)
            {
                OutPutJsonContentToPage("false", "用户名不能为空");
            }
            if (userPwd.Length == 0)
            {
                OutPutJsonContentToPage("false", "密码不能为空");
            }
            userPwd = LoginSession.GetMD5Str(userPwd);
            using (RedisClient client = CustomReaderWebConfig.GetCustomerReaderWebConfig.RedisSessionClient)
            {
                var pwd = client.GetValue(userName);
                if (pwd == null)
                {
                    if (pwd != userPwd)
                    {
                        OutPutJsonContentToPage("false", "用户名或者密码错误");
                    }
                }
                else
                {
                }
            }

            SessionItem si = new SessionItem();

            si.CreatedAt           = DateTime.Now;
            si.SessionItems        = userName;
            si.Port                = Request.Url.Port;
            LoginSession.UserLogin = si;
            Response.Redirect("content.aspx", true);
        }