protected void LoginButton_Click1(object sender, EventArgs e) { try { bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; // clear previous user input if (!isHuman) { // TODO: Captcha validation failed, show error message lbl_capcha.Text = "من فضلك ادخل الحروف مرة اخرى"; lbl_capcha.ForeColor = System.Drawing.Color.Red; } else { new DB().Admin_OnlineRequest_Insert(txt_name.Text, txt_phone.Text, txt_mail.Text, txt_City.Text, txt_adress.Text, txt_Donate.Text, DonateFor.SelectedItem.ToString(), DonateTime.SelectedItem.ToString(), txt_body.Text, DateTime.Now); txt_adress.Text = ""; txt_City.Text = ""; txt_Donate.Text = ""; txt_mail.Text = ""; txt_name.Text = ""; txt_phone.Text = ""; txt_body.Text = ""; lbl_error.Text = "تم الإرسال بنجاح"; lbl_error.ForeColor = System.Drawing.Color.Green; } } catch (Exception ex) { lbl_error.Text = "يوجد عطل الان من فضلك حاول فى وقت لاحق"; lbl_error.ForeColor = System.Drawing.Color.Red; } }
protected void ValidateCaptchaButton_Click(object sender, EventArgs e) { if (!IsPostBack) { // initialize the Captcha validation error label CaptchaIncorrectLabel.Text = "Incorrect CAPTCHA code!"; CaptchaIncorrectLabel.Visible = true; } if (IsPostBack) { // validate the Captcha to check we're not dealing with a bot string userInput = CaptchaCodeTextBox.Text; bool isHuman = ExampleCaptcha.Validate(userInput); CaptchaCodeTextBox.Text = null; // clear previous user input if (isHuman) { CaptchaCorrectLabel.Visible = true; CaptchaIncorrectLabel.Visible = false; CaptchaCorrectLabel.Text = "Correct!"; } else { CaptchaIncorrectLabel.Visible = true; CaptchaCorrectLabel.Visible = false; CaptchaIncorrectLabel.Text = "Incorrect!"; } } }
protected void btnRegistrar_Click(object sender, EventArgs e) { // validate the Captcha to check we're not dealing with a bot bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; // clear previous user input if (!isHuman) { // TODO: Captcha validation failed, show error message ModalPopUpMensajes.Show(); LabelMensaje.Text = "Error en el captcha."; } else { // TODO: captcha validation succeeded; execute the protected action BE.BE_UsuarioSuscripcion usuario = new BE.BE_UsuarioSuscripcion(); usuario.EMAIL = CU_Mail.Text; foreach (ListItem item in checkBoxListReg.Items) { if (string.Equals(item.Value, "Imagenes") && item.Selected) { usuario.IMAGENES = 1; } if (string.Equals(item.Value, "Riego") && item.Selected) { usuario.RIEGO = 1; } if (string.Equals(item.Value, "Humedad") && item.Selected) { usuario.HUMEDAD = 1; } } int resultado = gestorNewsletter.insertarMail(usuario); if (resultado == 0) { ModalPopUpMensajes.Show(); LabelMensaje.Text = "Registracion realizada con éxito"; } else if (resultado == 1) { ModalPopUpMensajes.Show(); LabelMensaje.Text = "El email ya está registrado."; } else if (resultado == 2) { ModalPopUpMensajes.Show(); LabelMensaje.Text = "Hubo un error al registrar el email."; } } }
protected void btnPay_Click(object sender, EventArgs e) { bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; // clear previous user input if (!isHuman) { // TODO: Captcha validation failed, show error message lbl_capcha.Text = "من فضلك ادخل الحروف مرة اخرى"; lbl_capcha.ForeColor = System.Drawing.Color.Red; } else { pnlRequest.Visible = false; try { decimal FinalAmount = decimal.Parse(vpc_Amount.Text) * 100; // Connect to the Payment Client VPCRequest conn = new VPCRequest(); // Add the Digital Order Fields for the functionality you wish to use // Core Transaction Fields conn.AddDigitalOrderField("vpc_Version", conn.Version); conn.AddDigitalOrderField("vpc_Command", conn.Command); conn.AddDigitalOrderField("vpc_AccessCode", conn.AccessCode); conn.AddDigitalOrderField("vpc_Merchant", conn.MerchantID); conn.AddDigitalOrderField("vpc_ReturnURL", conn.FormatReturnURL(Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Request.ApplicationPath)); conn.AddDigitalOrderField("vpc_MerchTxnRef", (DB.GetMaxIdahly() + 1).ToString()); conn.AddDigitalOrderField("vpc_OrderInfo", vpc_OrderInfo.Text); conn.AddDigitalOrderField("vpc_Amount", FinalAmount.ToString()); conn.AddDigitalOrderField("vpc_Currency", Currency_List.Text); conn.AddDigitalOrderField("vpc_Locale", drop_Project.SelectedValue); // Perform the transaction String url = conn.Create3PartyQueryString(); Page.Response.Redirect(url); } catch (Exception ex) { // Capture and Display the error information lblErrorMessage.Text = ex.Message + (ex.InnerException != null ? ex.InnerException.Message : ""); pnlError.Visible = true; try { } catch (Exception ex2) { // Do Nothing } } } }
protected void Button1_Click(object sender, EventArgs e) { if (!IsPostBack) { // initialize the Captcha validation error label CaptchaErrorLabel.Text = "Incorrect CAPTCHA code!"; CaptchaErrorLabel.Visible = false; } // setup client-side input processing ExampleCaptcha.UserInputID = CaptchaCode.ClientID; if (IsPostBack) { // validate the Captcha to check we're not dealing with a bot string userInput = CaptchaCode.Text; bool isHuman = ExampleCaptcha.Validate(userInput); CaptchaCode.Text = null; // clear previous user input if (isHuman) { CaptchaErrorLabel.Visible = false; // TODO: proceed with protected action UserInfoModel model = new UserInfoModel(); UserInformation info = new UserInformation(); info = model.GetUserInfoByEmail(TextBox1.Text); if (info != null) { if (info.SecretAnswer.Equals(TextBox2.Text)) { Response.Redirect("~/Pages/Account/ResetPage.aspx?id=" + info.GUID); } else { Literal1.Text = "Wrong Answer"; } } else { Literal1.Text = "Email not Registered"; } } else { CaptchaErrorLabel.Visible = true; } } }
protected void btnLogin_Click(object sender, EventArgs e) { // validate the Captcha to check we're not dealing with a bot bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; // clear previous user input if (!isHuman) { lblVal.Text = "Invalid Code."; return; } else { try { using (SalesDBEntities1 objEntity = new SalesDBEntities1()) { userDetail objUser = objEntity.userDetails.FirstOrDefault(users => users.userName == txtUserName.Text); if (objUser != null) { if (StringCipher.DecryptStringAES(objUser.userPass) == txtPass.Text) { Session["userID"] = objUser.userID; Session["userType"] = objUser.userGroupID; Session["userName"] = txtUserName.Text; Session["Name"] = objUser.firstName; Response.Redirect("~/Dashboard.aspx", false); } else { lblVal.Text = "Please verify your Password"; } } else { lblVal.Text = "Please check user name and password."; } } } catch (Exception ex) { appOperations.LogException(ex, "Login -Button Click"); lblVal.Text = "Something went wrong.<br/>Please try again later."; } } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { if (IsPostBack) { bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; if (!isHuman) { LabelStateCaptcha.Text = "FALIED"; } else { LabelStateCaptcha.Text = "SUCCESS"; } } }
protected void Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { // initialize the Captcha validation error label CaptchaErrorLabel.Text = "Incorrect CAPTCHA code!"; CaptchaErrorLabel.Visible = false; } // setup client-side input processing ExampleCaptcha.UserInputID = CaptchaCode.ClientID; if (IsPostBack) { // validate the Captcha to check we're not dealing with a bot string userInput = CaptchaCode.Text; bool isHuman = ExampleCaptcha.Validate(userInput); CaptchaCode.Text = null; // clear previous user input if (isHuman) { CaptchaErrorLabel.Visible = false; // TODO: proceed with protected action try { SendMail(); YourSubject.Text = ""; YourEmail.Text = ""; YourName.Text = ""; Comments.Text = ""; chkbxOptIntoMail.Checked = false; Panel1.Visible = false; DisplayMessage.Text = "Your message was delivered!"; DisplayMessage.Visible = true; } catch (Exception) { DisplayMessage.Text = "There was a problem sending your message. Please try again."; DisplayMessage.Visible = true; } } else { CaptchaErrorLabel.Visible = true; } } }
protected void BtnRegister_Click(object sender, EventArgs e) { bool isHuman = ExampleCaptcha.Validate(txtCaptcha.Text); if (isHuman) { if (RegPassword.Text.Length > 4) { PIServiceReference.WebService1SoapClient serviceRef = new PIServiceReference.WebService1SoapClient(); LbResult.Text = serviceRef.RegisterNewUsers(RegUsername.Text, RegPassword.Text, 0); } else { LbResult.Text = "Паролата трябва да е с дължина поне 5 символа!"; } } else { LbResult.Text = "Въведете текста от изображението правилно!"; } }
private void LoginWithPasswordHash() { List <string> salthashList = null; List <string> nameList = null; bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); if (!isHuman) { // clear previous user input CaptchaCodeTextBox.Text = ""; CaptchaErrorLabel.Text = "Text do not match"; } else { SqlConnection conn = new SqlConnection(@"data source = .\SQLEXPRESS; integrated security = true; database = BirdAndOwner"); SqlCommand cmd = null; SqlDataReader rdr = null; string sqlsel = "SELECT slowhashSalt, Firstname, Lastname FROM Users WHERE Username = @Username"; try { conn.Open(); cmd = new SqlCommand(sqlsel, conn); cmd.Parameters.Add("@Username", SqlDbType.NVarChar); cmd.Parameters["@Username"].Value = Server.HtmlEncode(TextBoxUserName.Text); rdr = cmd.ExecuteReader(); while (rdr.HasRows && rdr.Read()) { if (salthashList == null) { salthashList = new List <string>(); nameList = new List <string>(); } string saltHashes = rdr.GetString(rdr.GetOrdinal("slowhashSalt")); salthashList.Add(saltHashes); string fullName = rdr.GetString(rdr.GetOrdinal("Firstname")) + " " + rdr.GetString(rdr.GetOrdinal("Lastname")); nameList.Add(fullName); } rdr.Close(); if (salthashList != null) { for (int i = 0; i < salthashList.Count; i++) { string inputPassword = Server.HtmlEncode(TextBoxPassword.Text); bool validUser = PasswordStorage.VerifyPassword(inputPassword, salthashList[i]); if (validUser == true) { userlevel = 1; //set session parameters Session["Level"] = userlevel; Session["Username"] = nameList[i]; Response.BufferOutput = true; Response.Redirect("LoggedIn.aspx"); } else { LabelMessage.Text = "Invalid username or password"; userlevel = 0; //set session parameters Session["Level"] = userlevel; } } } } catch (Exception ex) { LabelMessage.Text = ex.Message; LabelMessage.Text = "Error occurred - please try again"; } } }
protected void btn_SignUp_Click(object sender, EventArgs e) { //Response.Write("<script>alert('testing');</script>"); try { ExampleCaptcha.UserInputID = CaptchaCode.ClientID; if (IsPostBack) { string userInput = CaptchaCode.Text; //validate the user input against the actual captcha code given by the library bool isHuman = ExampleCaptcha.Validate(userInput); CaptchaCode.Text = null; // clear previous user input //Continue further if the client is not a ROBOT if (isHuman) { // Checking for Email ID duplication if (CommonHelpers.IsDuplicateEmail(txt_Email.Text)) { lbl_EmailID.Text = "Email Already exists"; lbl_EmailID.Visible = true; } else { // If everything looks fine, store the user data in "Users" table CaptchaErrorLabel.Visible = false; // TODO: proceed with protected action SqlConnection con = new SqlConnection(strcon); if (con.State == ConnectionState.Closed) { con.Open(); } string query = "INSERT INTO Users(EmailAddress,Password,FirstName,LastName,DateOfBirth,RoleId)VALUES(@EmailAddress,@Password,@FirstName,@LastName,@DateOfBirth,@RoleId)"; SqlCommand cmd = new SqlCommand(query, con); cmd.Parameters.AddWithValue("@EmailAddress", txt_Email.Text.Trim()); cmd.Parameters.AddWithValue("@Password", CommonHelpers.Encrypt(txt_Password.Text)); //cmd.Parameters.AddWithValue("@ConfirmPassword", txt_ConfirmPassword.Text.Trim()); cmd.Parameters.AddWithValue("@FirstName", txt_FirstName.Text.Trim()); cmd.Parameters.AddWithValue("@LastName", txt_LastName.Text.Trim()); cmd.Parameters.AddWithValue("@DateOfBirth", txt_Dob.Value.Trim()); //having html date textbox cmd.Parameters.AddWithValue("@RoleId", "3"); cmd.ExecuteNonQuery(); con.Close(); //Response.Write("<script>alert('Registration Successful. ');</script>"); // To show Registration Successful message after signup Session["UserSignUp"] = true; Response.Redirect("Login.aspx"); } } else { CaptchaErrorLabel.Visible = true; CaptchaErrorLabel.Text = "Captcha failed"; } } } catch (Exception ex) { Response.Write("<script>alert('" + ex.Message + "')</script>"); } //ClearTextBoxes(this); }
protected void btnRegistrar_Click(object sender, EventArgs e) { //bool ok = false; //if (string.IsNullOrEmpty(checkCaptcha.Value)) //{ // Response.Write("<script>alert('Fallo capcha')</script>"); //} //else //{ // BE.BE_UsuarioSuscripcion usuario = new BE.BE_UsuarioSuscripcion(); // usuario.EMAIL = inpAltaEmail.Text; // foreach (ListItem item in checkBoxListReg.Items) // { // if (string.Equals(item.Value, "Imagenes") && item.Selected) // { // usuario.IMAGENES = 1; // } // if (string.Equals(item.Value, "Riego") && item.Selected) // { // usuario.RIEGO = 1; // } // if (string.Equals(item.Value, "Humedad") && item.Selected) // { // usuario.HUMEDAD = 1; // } // } // ok = gestorNewsletter.insertarMail(usuario); // if (ok) // { // AjaxControlToolkit.ModalPopupExtender mpelogin = (AjaxControlToolkit.ModalPopupExtender)Page.Master.FindControl("modalPopMaster"); // mpelogin.Show(); // //Response.Write("<script>alert('Alta Correcta')</script>"); // limpiarPantalla(); // } // else // { // Response.Write("<script>alert('Error al suscribirse')</script>"); // } //} if (IsPostBack) { // validate the Captcha to check we're not dealing with a bot bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; // clear previous user input if (!isHuman) { // TODO: Captcha validation failed, show error message Response.Write("<script language=javascript>alert('ERROR');</script>"); } else { // TODO: captcha validation succeeded; execute the protected action Response.Write("<script language=javascript>alert('OK');</script>"); } } }
protected void SubButL_Click(object sender, EventArgs e) { string clientIp = (Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ?? Request.ServerVariables["REMOTE_ADDR"]).Split(',')[0].Trim(); DataTable CheckIP = new DB().Admin_ip_GetByIP(clientIp); if (CheckIP.Rows.Count == 0) { bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; // clear previous user input if (!isHuman) { // TODO: Captcha validation failed, show error message lbl_capcha.Text = "من فضلك ادخل الحروف مرة اخرى"; lbl_capcha.ForeColor = System.Drawing.Color.Red; } else { new DB().Admin_ip_Insert(clientIp, DateTime.Parse(DateTime.Now.ToShortDateString()), 1); string link = string.Format("CS_VPC_3Party_DO.aspx?Title=DarAlorman&vpc_Version=1&vpc_Command=pay&vpc_AccessCode=090AF86A&vpc_MerchTxnRef={0}&vpc_Merchant=701342USD&vpc_OrderInfo={1}&vpc_ReturnURL={2}&vpc_Locale=en&vpc_Amount={3}&txtmail={4}&Project={5}", (Donorbm.GetMaxId() + 1).ToString(), txtmail.Text, Server.UrlEncode("http://dar-alorman.com/aaibUSD/CS_VPC_3Party_DR.aspx"), vpc_Amount.Text, txtmail.Text, drop_Project.SelectedValue); Response.Redirect(link); } } else { if (DateTime.Parse(CheckIP.Rows[0]["Datedonor"].ToString()) == DateTime.Parse(DateTime.Now.ToShortDateString())) { if (int.Parse(CheckIP.Rows[0]["num"].ToString()) > 3) { lbl_ERROR.Text = "لقد تجاوزت الحد الاقصى من المحاولات لديك , حاول مرة أخرى بعد مرور 24 ساعة"; lbl_ERROR.ForeColor = System.Drawing.Color.Red; } else { int ID = int.Parse(CheckIP.Rows[0]["ID"].ToString()); int num = int.Parse(CheckIP.Rows[0]["num"].ToString()) + 1; bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; // clear previous user input if (!isHuman) { // TODO: Captcha validation failed, show error message lbl_capcha.Text = "من فضلك ادخل الحروف مرة اخرى"; lbl_capcha.ForeColor = System.Drawing.Color.Red; } else { new DB().Admin_ip_Update(ID, clientIp, DateTime.Parse(DateTime.Now.ToShortDateString()), num); string link = string.Format("CS_VPC_3Party_DO.aspx?Title=DarAlorman&vpc_Version=1&vpc_Command=pay&vpc_AccessCode=090AF86A&vpc_MerchTxnRef={0}&vpc_Merchant=701342USD&vpc_OrderInfo={1}&vpc_ReturnURL={2}&vpc_Locale=en&vpc_Amount={3}&txtmail={4}&Project={5}", (Donorbm.GetMaxId() + 1).ToString(), txtmail.Text, Server.UrlEncode("http://dar-alorman.com/aaibUSD/CS_VPC_3Party_DR.aspx"), vpc_Amount.Text, txtmail.Text, drop_Project.SelectedValue); Response.Redirect(link); } } } else { bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; // clear previous user input if (!isHuman) { // TODO: Captcha validation failed, show error message lbl_capcha.Text = "من فضلك ادخل الحروف مرة اخرى"; lbl_capcha.ForeColor = System.Drawing.Color.Red; } else { new DB().Admin_ip_DeletebyDatedonor(DateTime.Parse(DateTime.Now.ToShortDateString())); new DB().Admin_ip_Insert(clientIp, DateTime.Parse(DateTime.Now.ToShortDateString()), 1); string link = string.Format("CS_VPC_3Party_DO.aspx?Title=DarAlorman&vpc_Version=1&vpc_Command=pay&vpc_AccessCode=090AF86A&vpc_MerchTxnRef={0}&vpc_Merchant=701342USD&vpc_OrderInfo={1}&vpc_ReturnURL={2}&vpc_Locale=en&vpc_Amount={3}&txtmail={4}&Project={5}", (Donorbm.GetMaxId() + 1).ToString(), txtmail.Text, Server.UrlEncode("http://dar-alorman.com/aaibUSD/CS_VPC_3Party_DR.aspx"), vpc_Amount.Text, txtmail.Text, drop_Project.SelectedValue); Response.Redirect(link); } } } //SubButL.Attributes.Add("onclick", "return false;"); //Form2.Action = "CS_VPC_3Party_DO.aspx"; }
protected void login_Click(object sender, EventArgs e) { string loginid = uname.Text; string password = pwd.Text; string role = DropDownList1.SelectedItem.Text; if (uname.Text == "" || pwd.Text == "") { msg.Text = "All details are mandatory."; msg.ForeColor = System.Drawing.Color.Red; return; } else { ExampleCaptcha.UserInputID = CaptchaCodeTextBox.ClientID; if (IsPostBack) { bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; if (!isHuman) { msg.Text = "Incorrect Captcha."; msg.ForeColor = System.Drawing.Color.Red; } else { try { carrentalEntities db = new carrentalEntities(); if (!idflag) { var q = from i in db.Logins where i.LoginId == loginid && i.Role == role && i.Password == password select i; if (q.Any()) { foreach (var i in q) { Session["role"] = i.Role; Session["loginid"] = i.LoginId; } if (Session["role"].ToString() == "Admin") { Response.Redirect("Admin.aspx"); } else if (Session["role"].ToString() == "Customer") { Response.Redirect("timecheck.aspx"); } else if (Session["role"].ToString() == "Owner") { Response.Redirect("ownerprofile.aspx"); } else if (Session["role"].ToString() == "DeliveryPerson") { Response.Redirect("chaufferprofile.aspx"); } } else { msg.Text = "Incorrect Credentials. Please try again."; msg.ForeColor = System.Drawing.Color.Red; } } } catch (Exception ex) { msg.Text = "Exception"; msg.ForeColor = System.Drawing.Color.Red; } } } } }
protected void btnlogin_Click(object sender, EventArgs e) { if (txtid.Text == "" || txtpass.Text == "") { lblerror.Text = "All details are mandatory."; return; } else { ExampleCaptcha.UserInputID = CaptchaCodeTextBox.ClientID; if (IsPostBack) { bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; if (!isHuman) { lblerror.Text = "Incorrect Captcha."; } else { try { using (DepartmentPortalDataContext db = new DepartmentPortalDataContext()) { if (!idflag) { var q = from i in db.Students where i.student_id == txtid.Text && i.password == txtpass.Text select i; if (q.Any()) { foreach (var i in q) { Session["id"] = i.student_id; Session["username"] = i.full_name; Session["sem"] = i.current_sem; Session["branch"] = i.branch; DateTime today = DateTime.Now; today = today.AddDays(-1); var ev = from j in db.Events where today.CompareTo(j.date) < 0 select j; var notifs = (from j in db.notifications where today.CompareTo(j.notifdate) < 0 select j.notif).ToList(); foreach (var k in ev) { string msg = "Tomorrow is " + k.name; if (!notifs.Contains(msg)) { notification n = new notification() { notifdate = DateTime.Now, notif = msg }; db.notifications.InsertOnSubmit(n); db.SubmitChanges(); } } Response.Redirect("studenthome.aspx"); } } else { lblerror.Text = "Incorrect Credentials. Please try again."; } } else { var q = from i in db.Faculties where i.faculty_id == txtid.Text && i.password == txtpass.Text select i; if (q.Any()) { foreach (var i in q) { Session["id"] = i.faculty_id; Session["username"] = i.faculty_name; Session["type"] = i.user_type; Response.Redirect("facultyprofile.aspx"); } } else { lblerror.Text = "Incorrect Credentials. Please try again."; } } } } catch (Exception ex) { lblerror.Text = "Exception"; } } } } }
protected void SubButL_Click(object sender, EventArgs e) { string clientIp = (Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ?? Request.ServerVariables["REMOTE_ADDR"]).Split(',')[0].Trim(); bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text); CaptchaCodeTextBox.Text = null; // clear previous user input if (!isHuman) { // TODO: Captcha validation failed, show error message lbl_capcha.Text = "من فضلك ادخل الحروف مرة اخرى"; lbl_capcha.ForeColor = System.Drawing.Color.Red; } else { if (Visa.Checked == false && Master.Checked == false) { lbl_ERROR.Text = "من فضلك إختر نوع الكارت"; } else { if (Visa.Checked) { Radio.Text = "Visa"; } else if (Master.Checked) { Radio.Text = "MasterCard"; } //Dictionary of the parameters sent with the http request. var parameters = new Dictionary <string, string>(); decimal FinalAmount = decimal.Parse(Amount.Text) * 100; parameters.Add("amount", FinalAmount.ToString()); parameters.Add("currency", "EGP"); parameters.Add("merchant_identifier", "vftBmzKl"); parameters.Add("access_code", "X9nbMqo2ZSyXdQwoqBkT"); parameters.Add("order_description", drop_Project.SelectedValue); int refe = CIBDonor.GetMaxId() + 5; string refrence = refe.ToString(); parameters.Add("merchant_reference", refrence); parameters.Add("customer_email", txtmail.Text); //parameters.Add("customer_ip", clientIp); parameters.Add("language", "en"); //parameters.Add("Project", drop_Project.SelectedItem.ToString()); parameters.Add("command", "PURCHASE"); //parameters.Add("return_url", "http://www.dar-alorman.com/donateCIB/CS_VPC_3Party_DR.aspx"); //parameters.Add("customer_name", txtname.Text); var sortedParameters = parameters.OrderBy(x => x.Key); var stringSortedParameteres = sortedParameters.Aggregate("PASS", (current, item) => current + (item.Key + "=" + item.Value)); stringSortedParameteres += "PASS"; string hashedSignature = String.Empty; var crypt = SHA256.Create(); string hash = string.Empty; var crypto = crypt.ComputeHash(Encoding.ASCII.GetBytes(stringSortedParameteres), 0, Encoding.ASCII.GetByteCount(stringSortedParameteres)); hash = crypto.Aggregate(hash, (current, b) => current + b.ToString("x2")); parameters.Add("signature", hash); var temp = parameters.Select(d => string.Format("\"{0}\": \"{1}\"", d.Key, string.Join(",", d.Value))); var jsonRequestString = "{" + string.Join(",", temp) + "}"; var data = Encoding.ASCII.GetBytes(jsonRequestString); var parameterValues = new NameValueCollection(); foreach (var item in parameters) { parameterValues.Add(item.Key, item.Value); } RedirectWithData("https://checkout.payfort.com/FortAPI/paymentPage", parameterValues); } } }