工行在线支付问题
namespace NetPayICBC
{
public class ICBCPay
{
public static int payModeId = 14;
string merURL = "http://" + HttpContext.Current.Request.Url.Host + "/payredirect/ICBC_Return.aspx"; //接收银行消息地址
public string ICBCPayForm(OrderInfo order)
{
string amount = Convert.ToInt32(BLLFactory.CreateOrderBLL().GetTotalAmount(order.OrderID) - order.HavePaidAmount).ToString();//订单金额
string orderDate = order.AddDate.ToString("yyyyMMddHHmmss"); //格式yyyyMMddHHmmss
string merCert = "";//证书公钥,下面赋值
string merSignMsg = "";//加密后的字符串,下面赋值
string path1 = "d:\\ebb2cpublic.crt";//public公钥路径
string path2 = "d:\\user.crt";//拆分pfx后缀的证书后的公钥路径
string path3 = "d:\\user.key";//拆分pfx后缀的证书后的私钥路径
string key = "12345678";//私钥保护密码
string tranData = @"<?xml version='1.0' encoding='GBK' standalone='no'?><B2CReq><inte易做图ceName>ICBC_PERBANK_B2C</inte易做图ceName><inte易做图ceVersion>1.0.0.3</inte易做图ceVersion><orderInfo><orderDate>" + orderDate + "</orderDate><orderid>" + order.OrderID + "</orderid><amount>" + amount + "</amount><curType>001</curType><merID>0200EC512350693</merID><merAcct>0200004651000100173</merAcct></orderInfo><custom><verifyJoinFlag>0</verifyJoinFlag><Language>ZH_CN</Language></custom><message><goodsID></goodsID><goodsName></goodsName><goodsNum></goodsNum><carriageAmt></carriageAmt><merHint></merHint><remark1></remark1><remark2></remark2><merURL>" + merURL + "</merURL><merVAR></merVAR></message></B2CReq>";
byte[] bytes = Encoding.Default.GetBytes(tranData);
string str = Convert.ToBase64String(bytes);
ICBCEBANKUTILLib.B2CUtil obj = new ICBCEBANKUTILLib.B2CUtilClass();
StringBuilder sb = new StringBuilder();
if (obj.init(path2, path2, path3, key) == 0) //加载公钥、私钥、密码,如果返回0则初始化成功
{
merSignMsg = obj.signC(tranData, tranData.Length);//加密明文
merCert = obj.getCert(1);//提取证书
sb.Append("<form action=\"https://mybank.dccnet.com.cn/servlet/ICBCINBSEBusinessServlet\" name=\"sendOrder\" method=\"post\">");
sb.Append("<input name=\"inte易做图ceName\" type=\"hidden\" value=\"ICBC_PERBANK_B2C\">");
sb.Append("<input name=\"inte易做图ceVersion\" type=\"hidden\" value=\"1.0.0.3\">");
sb.Append("<input name=\"tranData\" type=\"hidden\" value=\""+str+"\">");
sb.Append("<input name=\"merSignMsg\" type=\"hidden\" value=\""+merSignMsg+"\">");
sb.Append("<input name=\"merCert\" type=\"hidden\" value=\""+merCert+"\">");
sb.Append("</form>");
}
else
{
HttpContext.Current.Response.Write("<div style='display:none'>加密失败!返回代码" + obj.getRC() + ",请查看日志。</div>"); //返回签名失败信息
}
return sb.ToString();
}
}
}
选择工行支付以后页面不会往工行网站跳转,还是我哪写错了?高手帮看下 --------------------编程问答-------------------- 那应该就一个表单提交啊.直接提交到工行指定页面的. --------------------编程问答-------------------- 冒泡
没分也问问题 --------------------编程问答-------------------- 这不才注册的账号没分么~~~ --------------------编程问答-------------------- 没分
算了 你这样form是没有执行的
补充:.NET技术 , ASP.NET