表单发布后,Asp.net 重定向到银行短信验证 (3DPay) 页面

问题描述

我正在尝试创建信用卡付款页面。 我在后面的代码(C#)中发布表单并成功从银行获取验证短信。 但它不会重定向到银行短信验证页面,因此无法输入验证码。 那我该怎么办?

Here is my code under the Pay button:
   String shopCode = "SHOPCODE";
        String purchaseAmount = "ORDER PRICE";
        String currency = "CURRENCY";
        String orderId = "ORDERID";
        String okUrl = "REDIRECT PAGE AFTER SMS VERIFICATION COMPLETED SUCCESSFULLY";
        String failUrl = "REDIRECT PAGE IF SMS VERIFICATION FAILS";
        String rnd = DateTime.Now.ToString();

        String installmentCount = "3";
        String txnType = "txnType";
        String merchantPass = "merchantpass";
        String str = shopCode + orderId + purchaseAmount + okUrl + failUrl + txnType + installmentCount + rnd + merchantPass;

        System.Security.Cryptography.SHA1 sha = new System.Security.Cryptography.SHA1CryptoServiceProvider();
        byte[] bytes = System.Text.Encoding.GetEncoding("ISO-8859-9").GetBytes(str);
        byte[] hashingbytes = sha.ComputeHash(bytes);

        String hash = Convert.ToBase64String(hashingbytes);

        String cardnumber = "CREDIT CARD NUMBER";
        String expiry = "EXPIRY DATE";
        String CVCCVV = "CVCNUMBER";
        String securetype = "3DPay";
        String lang = "language";

        ASCIIEncoding encoding = new ASCIIEncoding();
        string postData = "Pan=" + cardnumber;
        postData += ("&Expiry=" + expiry);
        postData += ("&Cvv2=" + CVCCVV);
        postData += ("&ShopCode=" + shopCode);
        postData += ("&PurchAmount=" + purchaseAmount);
        postData += ("&Currency=" + currency);
        postData += ("&OrderId=" + orderId);
        postData += ("&OkUrl=" + okUrl);
        postData += ("&FailUrl=" + failUrl);
        postData += ("&Rnd=" + rnd);
        postData += ("&Hash=" + hash);
        postData += ("&TxnType=" + txnType);
        postData += ("&InstallmentCount=" + installmentCount);
        postData += ("&SecureType=" + securetype);
        postData += ("&Lang=" + lang);

        byte[] data = encoding.GetBytes(postData);

        HttpWebRequest myRequest =
          (HttpWebRequest)WebRequest.Create("POSURL");
        myRequest.Method = "POST";
        myRequest.ContentType = "application/x-www-form-urlencoded";
        myRequest.ContentLength = data.Length;
        Stream newStream = myRequest.GetRequestStream();

        newStream.Write(data,data.Length);
        newStream.Close();

编辑: 如果我在客户端 (html) 端执行它可以正常工作,但我想在服务器端执行它。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)