Example #1
0
    protected void BtnConfirm_Click(object sender, EventArgs e)
    {
        string        pwd    = "";
        string        name   = Request.Cookies["RePwdName"].Value.ToString();
        MemberInfoDAL obj    = new MemberInfoDAL();
        string        answer = obj.GetAnswerByEmail(Request.Cookies["RePwdName"].Value.ToString());

        if (answer == this.TxtAnswer.Text.ToString())
        {
            try
            {
                string mail = GetEmailByLoginName();
                //发送密码设置页
                RegisterMail mailB    = new RegisterMail();
                string       url      = mailB.GetMailResetTemplateUrl();
                string       domain   = "http://" + Request.ServerVariables["SERVER_NAME"].ToString();
                string       validurl = domain + Request.RawUrl.Replace("RetrieveStep6.aspx", "RetrieveStep3.aspx");

                mailB.SendResetMail(Server.MapPath(url), name, pwd, mail, validurl, domain);
                Response.Redirect("succeedByqu.aspx?Email=" + mail + "");
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('请重试!" + ex.Message + "'); </script>");
            }
        }
        else
        {
            this.LblMessage.Text = "回答密码保护问题错误!";
        }
    }
Example #2
0
    protected void BtnSendmail_Click(object sender, EventArgs e)
    {
        //判断用户名与使用邮箱是否匹配
        string mail    = this.txtEmail.Text.Trim().ToString();
        string name    = Request.Cookies["RePwdName"].Value.ToString();
        string strmail = GetEmailByLoginName();
        string pwd     = "";

        //try
        //{
        if (strmail.Trim().Length > 0)
        {
            if (strmail == mail)
            {
                MemberInfoDAL obj = new MemberInfoDAL();
                //try
                //{
                //发送密码设置页
                RegisterMail mailB    = new RegisterMail();
                string       url      = mailB.GetMailResetTemplateUrl();
                string       domain   = "http://" + Request.ServerVariables["SERVER_NAME"].ToString();
                string       validurl = domain + Request.RawUrl.Replace("RetrieveStep2.aspx", "RetrieveStep3.aspx");

                mailB.SendResetMail(Server.MapPath(url), name, pwd, mail, validurl, domain);
                Response.Redirect("succeedByemail.aspx?Email=" + mail + "");
                //}
                //catch (Exception ex)
                //{
                //    Response.Write("<script>alert('请重试!" + ex.Message + "'); </script>");
                //}
            }
            else
            {
                Response.Redirect("RetrieveStep4.aspx");
            }
        }
        //}
        //catch
        //{

        //}
    }