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 } } } }