protected void btn_save_Click(object sender, EventArgs e) { tbl_user_BAL objbal = new tbl_user_BAL(); tbl_user_DAL objdal = new tbl_user_DAL(); cryptography objcrypt = new cryptography(); SqlConnection cn = new SqlConnection(ConfigurationManager.AppSettings["dbconnect"]); string query = "select_tbl_user"; SqlCommand cm = new SqlCommand(query, cn); cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("@cnd", " where int_user_id=" + Session["uid"].ToString()); SqlDataAdapter da = new SqlDataAdapter(cm); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { string pwd = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString()); if (pwd == old_pass.Text) { objdal.int_user_id = Convert.ToInt16(Session["uid"]); string str = objcrypt.Encrypt(new_pass.Text); objdal.str_password = str; int val = objbal.update_pass(objdal); objbal.update_pass(objdal); if (val > 0) { lblmsg.Text = "your password is successfully updated."; lblmsg.ForeColor = System.Drawing.Color.Green; } else { lblmsg.Text = "Error in Process,try again."; lblmsg.ForeColor = System.Drawing.Color.Red; } } else { lblmsg.Text = "your have entered wrong password."; lblmsg.ForeColor = System.Drawing.Color.Red; } } changepanel(1, 0, 0); }
protected void btn_login_Click(object sender, EventArgs e) { try { tbl_voluntar_BAL objbal = new tbl_voluntar_BAL(); cryptography objcrypt = new cryptography(); string query = "where str_email='" + txt_voluntar_name.Text + "'"; DataSet ds = objbal.getdata(query); if (ds.Tables[0].Rows.Count > 0) { string str = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString()); if (str.Equals(txt_password.Text)) { Session["vname"] = txt_voluntar_name.Text; Session["vtype"] = "v"; Response.Redirect("inquiry_reply_page.aspx"); } } } catch (Exception ex) { } }
protected void btn_add_Click1(object sender, EventArgs e) { try { tbl_user_BAL objbal = new tbl_user_BAL(); cryptography objcrypt = new cryptography(); string query = "where str_email='" + txt_user_name.Text + "'"; DataSet ds = objbal.getdata(query); if (ds.Tables[0].Rows.Count > 0) { string str = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString()); //int cnt = Convert.ToInt16(ds.Tables[0].Rows[0]["int_user_id"]); if (str.Equals(txt_password.Text)) { Session["uname"] = txt_user_name.Text; Session["uid"] = ds.Tables[0].Rows[0]["int_user_id"]; Session["unm"] = ds.Tables[0].Rows[0]["str_user_name"]; Session["add"] = ds.Tables[0].Rows[0]["str_address"]; Session["con"] = ds.Tables[0].Rows[0]["int_contact"]; Session["email"] = ds.Tables[0].Rows[0]["str_email"]; Response.Redirect("inquiry_page.aspx"); } } } catch (Exception ex) { } }
protected void btn_add_Click1(object sender, EventArgs e) { try { cryptography objcrypt = new cryptography(); tbl_login_BAL objbal = new tbl_login_BAL(); string query = " where str_user_name='" + txt_user_name.Text + "'"; DataSet ds = objbal.getData(query); if (ds.Tables[0].Rows.Count > 0) { string str = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString()); if (str.Equals(txt_password.Text)) { Session["uname"] = txt_user_name.Text; Session["name"] = ds.Tables[0].Rows[0]["str_user_name"].ToString(); Session["img"] = ds.Tables[0].Rows[0]["str_img"].ToString(); Response.Redirect("home.aspx"); } else { lbl_error.Text = "wrong email and password ..try again.."; lbl_error.ForeColor = System.Drawing.Color.Red; } } } catch (Exception ex) { } }
protected void btn_login_Click(object sender, EventArgs e) { try { tbl_user_BAL objbal = new tbl_user_BAL(); cryptography objcrypt = new cryptography(); string query = "where str_email='" + txt_user_name.Text + "'"; DataSet ds = objbal.getdata(query); if (ds.Tables[0].Rows.Count > 0) { string str = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString()); //int cnt = Convert.ToInt16(ds.Tables[0].Rows[0]["int_user_id"]); if (str == txt_password.Text) { if (str.Equals(txt_password.Text)) { Session["uname"] = txt_user_name.Text; Session["uid"] = ds.Tables[0].Rows[0]["int_user_id"]; Session["unm"] = ds.Tables[0].Rows[0]["str_user_name"]; Session["add"] = ds.Tables[0].Rows[0]["str_address"]; Session["con"] = ds.Tables[0].Rows[0]["int_contact"]; Session["email"] = ds.Tables[0].Rows[0]["str_email"]; Response.Redirect("user_profile.aspx"); } } else { lblmsg.Text = "wrong emailid and password ..try again..."; lblmsg.ForeColor = System.Drawing.Color.Red; } } else { lblmsg.Text = "wrong emailid and password ..try again..."; lblmsg.ForeColor = System.Drawing.Color.Red; } } catch (Exception ex) { } }
protected void SendMail() { try { cryptography objcrypt = new cryptography(); SqlConnection cn = new SqlConnection(ConfigurationManager.AppSettings["dbconnect"]); string query = "select_tbl_user"; SqlCommand cm = new SqlCommand(query, cn); cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("@cnd", " where str_email='" + txt_email.Text + "'"); SqlDataAdapter da = new SqlDataAdapter(cm); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { //string pwd = ds.Tables[0].Rows[0]["str_password"].ToString(); string pwd = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString()); // Gmail Address from where you send the mail var fromAddress = "*****@*****.**"; // any address where the email will be sending //var toAddress = "*****@*****.**"; var toAddress = txt_email.Text; //Password of your gmail address const string fromPassword = "******"; // Passing the values and make a email formate to display string subject = "Forget Password"; StringBuilder str = new StringBuilder(); StringBuilder sb = new StringBuilder(); sb.Append("Your Password is "); sb.Append(pwd); //sb.Append("<head></head>"); //sb.Append("<body>"); //sb.Append("<div>My Test Div </div>"); //sb.Append("</body>"); //sb.Append("</html>"); //str.AppendLine("WelCome to Resume Maker Site."); //str.AppendLine("\n"); //str.AppendFormat("Click <a href='{0}'>here</a> To activate yourself.", "https://www.google.co.in/?gws_rd=cr&ei=KiXnUqfsCsmOrQf_x4GYAg"); // smtp settings var smtp = new System.Net.Mail.SmtpClient(); { smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; smtp.Credentials = new NetworkCredential(fromAddress, fromPassword); smtp.Timeout = 20000; } // Passing values to smtp object smtp.Send(fromAddress, toAddress, subject, sb.ToString()); } } catch (Exception ex) { } }