开发工具:
文件大小: 18kb
下载次数: 0
上传时间: 2008-11-24
详细说明: using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Text; using System.Security.Cryptography; /// /// New Interface for AliPay /// namespace Gateway { /// /// created by sunzhizhi 2006.5.21,sunzhizhi@msn.com。 /// public class AliPay { public static string GetMD5(string s) { /// /// 与ASP兼容的MD5加密算法 /// MD5 md5 = new MD5CryptoServiceProvider(); byte[] t = md5.ComputeHash(Encoding.GetEncoding("gb2312").GetBytes(s)); StringBuilder sb = new StringBuilder(32); for (int i = 0; i < t.Length; i++) { sb.Append(t[i].ToString("x").PadLeft(2, '0')); } return sb.ToString(); } public static string[] BubbleSort(string[] r) { /// /// 冒泡排序法 /// int i, j; //交换标志 string temp; bool exchange; for (i = 0; i < r.Length; i++) //最多做R.Length-1趟排序 { exchange = false; //本趟排序开始前,交换标志应为假 for (j = r.Length - 2; j >= i; j--) { if (System.String.CompareOrdinal(r[j + 1], r[j]) < 0) //交换条件 { temp = r[j + 1]; r[j + 1] = r[j]; r[j] = temp; exchange = true; //发生了交换,故将交换标志置为真 } } if (!exchange) //本趟排序未发生交换,提前终止算法 { break; } } return r; } public string CreatUrl( string gateway, string service, string partner, string sign_type, string out_trade_no, string subject, string body, string quantity, string price, string show_url, string seller_email, string key, string return_url, string notify_url, string logistics_type, string logistics_fee, string logistics_payment, string logistics_type_1, string logistics_fee_1, string logistics_payment_1, string payment_type ) { /// /// created by sunzhizhi 2006.5.21,sunzhizhi@msn.com。 /// int i; //构造数组; string[] Oristr ={ "service="+service, "partner=" + partner, "subject=" + subject, "body=" + body, "out_trade_no=" + out_trade_no, "price=" + price, "show_url=" + show_url, "quantity=" + quantity, "seller_email=" + seller_email, "notify_url=" + notify_url, "return_url=" + return_url, "logistics_type="+logistics_type, "logistics_fee="+logistics_fee , "logistics_payment="+logistics_payment, "logistics_type_1="+logistics_type_1, "logistics_fee_1="+logistics_fee_1, "logistics_payment_1="+logistics_payment_1, "payment_type=" + payment_type }; //进行排序; string[] Sortedstr = BubbleSort(Oristr); //构造待md5摘要字符串 ; StringBuilder prestr = new StringBuilder(); for (i = 0; i < Sortedstr.Length; i++) { if (i == Sortedstr.Length - 1) { prestr.Append(Sortedstr[i]); } else { prestr.Append(Sortedstr[i] + "&"); } } prestr.Append(key); //生成Md5摘要; string sign = GetMD5(prestr.ToString()); //构造支付Url; StringBuilder parameter = new StringBuilder(); parameter.Append(gateway); for (i = 0; i < Sortedstr.Length; i++) { parameter.Append(Sortedstr[i] + "&"); } parameter.Append("sign=" + sign + "&sign_type=" + sign_type); //返回支付Url; return parameter.ToString(); } } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.