Esempio n. 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (WebCommon.CheckValidateCode())//判断验证码
            {
                context.Session["vCode"] = null;
                string msg = string.Empty;
                //完成用户注册
                if (UserRegister(context, out msg))
                {
                    //1:注册成功表示已经登录。
                    context.Session["userInfo"] = userInfo;
                    //2:发送激活的邮件

                    context.Response.Write("yes:" + msg);
                }
                else
                {
                    context.Response.Write("no:" + msg);
                }
            }
            else
            {
                context.Response.Write("no:验证码错误!!");
            }
        }
Esempio n. 2
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     if (WebCommon.CheckValidateCode())
     {
         context.Response.Write("yes");
     }
     else
     {
         context.Response.Write("no");
     }
 }
Esempio n. 3
0
        //验证用户名密码 设置自动登陆
        public bool CheckUserInfo()
        {
            //测试密码都是123456
            string userName = Request["txtUsername"];
            string password = Request["txtPassword"];

            string vardateCode = Request["txtYzm"];

            //验证码

            if (!WebCommon.CheckValidateCode(vardateCode))
            {
                Msg = "验证码错误!";
                return(false);
            }

            string msg = "";

            BookShop.Model.User user        = null;
            UserManager         userManager = new UserManager();
            bool isLogin = userManager.CheckUserInfo(userName, password, out msg, out user);

            if (isLogin)
            {
                //将每一个对象存储dao session中 。。(里面存储的是字符串类型 还是字符串 是的话如何转换)
                //如果自动登录 想消息记录的 cookie中
                //如果现在自动登录 就用用户名 和两次加密后的密码 存储到cookie中
                // 如果是使用web form 就不用考录请求 相应的东西。。就按钮点击了要怎么样。。发生一个什么什么事件了 又怎么样 这样来考虑
                // 不要太混合起来考虑 容易弄混掉。

                if (!string.IsNullOrEmpty(Request["autoLogin"]))
                {
                    HttpCookie ck1 = new HttpCookie("cp1", userName);
                    //password = ;
                    HttpCookie ck2 = new HttpCookie("cp2", WebCommon.GetMd5String(WebCommon.GetMd5String(password).ToUpper()));
                    ck1.Expires.AddDays(7);
                    ck2.Expires.AddDays(7);
                    Response.Cookies.Add(ck1);
                    Response.Cookies.Add(ck2);
                }
                Session["userInfo"] = user;
                // 登录成功之后回到之前的页面
                if (string.IsNullOrEmpty(Request["HiddenReturnUrl"]))
                {
                    Response.Redirect("/Index.aspx");
                }
                else
                {
                    Response.Redirect(Request["HiddenReturnUrl"]);
                }
            }
            else
            {
                //跳转到提示页面给出提示
                //在页面的某一块位置显示一下消息。。
                //注册一个js 的方法 给出提示
                Msg = msg;
            }
            return(true);
            //userInfo.g
        }