示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["email"] != null)
     {
         Response.Redirect("HomePage.aspx");
     }
     if (Request.Form["submit"] != null)
     {
         string email = Request.Form["email"];
         if (MyADOHelper.Exist(email))
         {
             ClientScript.RegisterStartupScript(GetType(), "Verifyaspx", "aspxVerification(true);", true);
         }
         else
         {
             MyADOHelper.Insert(email, Request.Form["reguser"], Request.Form["finame"], Request.Form["laname"], Request.Form["passmake"], int.Parse(Request.Form["gender"]), Request.Form["bdate"], Request.Form["country"], char.Parse(Request.Form["securequest"]), Request.Form["secureans"]);
             if (MyADOHelper.errorMessage != null)
             {
                 Response.Write(MyADOHelper.errorMessage);
                 MyADOHelper.errorMessage = null;
             }
             else
             {
                 Response.Redirect("SignIn.aspx");
             }
         }
     }
 }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["email"] != null)
            {
                Response.Redirect("HomePage.aspx");
            }
            Random rnd = new Random();

            if (Request.Form["submit"] != null)
            {
                if (MyADOHelper.Exist(Request.Form["email"]))
                {
                    ClientScript.RegisterStartupScript(GetType(), "Send Mail Message", "sendMailMessage(true);", true);
                    Session["v"] = rnd.Next(99999999);
                    Session["changePassEmail"] = Request.Form["email"];
                    MailMessage mail = new MailMessage();
                    mail.To.Add(Request.Form["email"]);
                    mail.From       = new MailAddress("*****@*****.**");
                    mail.Subject    = "INCloud Password Change";
                    mail.Body       = "Click this link to change your password: \n http://localhost:57646/Pages/ChangePass.aspx?v=" + (int)Session["v"] + "&m=" + Request.Form["email"];
                    mail.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
                    smtp.EnableSsl             = true;
                    smtp.UseDefaultCredentials = false;
                    smtp.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "itay2003");
                    smtp.Send(mail);
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(), "Send Mail Message", "sendMailMessage(false);", true);
                }
            }
        }