Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string msg = "激活链接无效!";
            int id;
            if (int.TryParse(context.Request.QueryString["uid"], out id))
            {
                string code = context.Request.QueryString["code"];
                if (!string.IsNullOrEmpty(code))
                {
                    UsersBLL ub = new UsersBLL();
                    Users u = ub.GetModel(id);
                    if (u != null && u.ActiveCode == code)
                    {
                        if (u.Actived == false)
                        {
                            if ((ub.SetActived(id)))
                            {
                                msg = "账户激活成功!";
                            }
                            else
                            {
                                msg = "账户激活失败!";
                            }
                        }
                        else
                        {
                            msg = "账户已激活!";
                        }
                    }
                }
            }

            context.Response.Redirect("/ShowMsg.aspx?m=" + HttpUtility.UrlEncode(msg) + "&t=" + HttpUtility.UrlEncode("登陆页面") + "&u=/Login.aspx");
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int uid;
                string code = Request.QueryString["code"];
                string msg = "";
                if (int.TryParse(Request.QueryString["uid"], out uid))
                {
                    if (!string.IsNullOrEmpty(code))
                    {
                        Users u = new UsersBLL().GetModel(uid);
                        if (u != null)
                        {
                            lblName.Text = u.LoginId;
                            hdUid.Value = u.Id.ToString();
                        }
                        else
                        {
                            msg = "用户不存在!";
                        }
                    }
                    else
                    {
                        msg = "参数错误!";
                    }
                }
                else
                {
                    msg = "参数错误!";
                }

                if (!string.IsNullOrEmpty(msg))
                {
                    Response.Redirect("/ShowMsg.aspx?m=" + HttpUtility.UrlEncode(msg) + "&t=" + HttpUtility.UrlEncode("首页") + "&u=/Default.aspx");
                }
            }
            else
            {
                UsersBLL ub = new UsersBLL();
                Users u = ub.GetModel(Convert.ToInt32(hdUid.Value));
                u.LoginPwd = Request.Form["txtPass"];
                if (ub.Update(u))
                {
                    ClearCookies();
                    Response.Redirect("/ShowMsg.aspx?m=" + HttpUtility.UrlEncode("修改密码成功,请重新登录!") + "&t=" + HttpUtility.UrlEncode("登录") + "&u=Login.aspx");
                }
                else
                {
                    txtMsg.Text = "修改密码失败!";
                }
            }
        }