protected void btnRegisteration_Click(object sender, EventArgs e) { try { if (Captcha1.IsValid == false) { litInfo.Text = "Invalid verification code! Please check."; Captcha1.Generate(); Captcha1.Clear(); RequiredFieldValidator2.ErrorMessage = ""; return; } else { if (txt_NEmail.Text != "") { Captcha1.Generate(); SqlConnection con = DataAccess.GetConnction(); DataTable dt = new DataTable(); SqlCommand cmd = new SqlCommand("Usp_ValidateOneTimePassword", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter { ParameterName = "@UserEmail", DbType = DbType.String, Value = txt_NEmail.Text }); cmd.Parameters.Add(new SqlParameter { ParameterName = "@LoginId", DbType = DbType.String, Value = txtloginId.Text }); cmd.Parameters.Add(new SqlParameter { ParameterName = "@OneTimePassword", DbType = DbType.String, Value = txtotp.Text }); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); } if (dt.Rows.Count > 0) { Session["UserEmail"] = txt_NEmail.Text; Session["LoginID"] = txtloginId.Text; ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('One Time Password (OTP) is Successfully Verified');window.location ='PublicUser.aspx';", true); } else { Alert.show("One Time Password (OTP) is incorrect"); } } else { txt_NEmail.Focus(); Alert.show("Email ID is Mandatory Fields!"); } } } catch (Exception ex) { LogError(ex); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (Page.IsValid) { if (Captcha1.IsValid == false) { //AuditLogModule.LogEntry("Captcha code didn't match!", txtLoginId.Text) litInfo.Text = "Invalid verification code! Please check."; Captcha1.Generate(); return; } Captcha1.Generate(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (Captcha1.IsValid == false) { litInfo.Text = "Invalid verification code! Please check."; Captcha1.Generate(); Captcha1.Clear(); txtPassword.Text = ""; txtconpwd.Text = ""; RequiredFieldValidator2.ErrorMessage = ""; return; } else { string saltedPasswordHash = txtPassword.Text; Captcha1.Generate(); obj = new PPRDataBL(); int designationid = 0; int department = 0; if (ddl_NDesignation.SelectedValue == "99999") { designationid = obj.insertDesignationDataBL(txtDesignation.Text); } if (ddlDeparment.SelectedValue == "99999" && txtOtherDepartment.Text != "") { department = obj.insertDepartmentDataBL(ddlMinistry.SelectedValue, HttpUtility.HtmlEncode(txtOtherDepartment.Text)); } int success = obj.sendPublicUserDataBL(ddlMinistry.SelectedValue, ddlDeparment.SelectedValue == "99999" && txtOtherDepartment.Text == "" ? ddlDeparment.SelectedValue : department.ToString(), ddl_NDesignation.SelectedValue == "99999" ? designationid.ToString() : ddl_NDesignation.SelectedValue, HttpUtility.HtmlEncode(txtloginId.Text) , HttpUtility.HtmlEncode(saltedPasswordHash), HttpUtility.HtmlEncode(txt_NName.Text), HttpUtility.HtmlEncode(""), HttpUtility.HtmlEncode(txt_NAddress1.Text), HttpUtility.HtmlEncode(txt_NAddress2.Text), HttpUtility.HtmlEncode(txt_NAddress3.Text), HttpUtility.HtmlEncode(txt_NTelephone.Text), HttpUtility.HtmlEncode(txt_NMobile.Text), HttpUtility.HtmlEncode(txt_NEmail.Text)); SaveToPDF(HttpUtility.HtmlEncode(HttpUtility.HtmlEncode(txtloginId.Text))); if (success > 0) { string folderPath = Server.MapPath("~/writedata/UserRegisteration/"); string FileName = (folderPath + ViewState["UserRegisterationFile"].ToString()); MailUtility objm = new MailUtility(); objm.SendUserDetailsMail(txt_NEmail.Text, "User Registration", txtloginId.Text, FileName, hdnPassCap.Value.ToString()); Captcha1.Clear(); reset(); string strScript = "<script>" + "alert('Data save successfully, Details send on your mail, You can login after verified by your admin.');"; strScript += "window.location='Login.aspx';"; strScript += "</script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Startup", strScript); Session["UserEmail"] = null; Session["LoginID"] = null; } else { Alert.show("User already exist please choose another user id"); Captcha1.Clear(); } } } catch (Exception ex) { LogError(ex); } }