[转]建行B2B支付回调参数乱码现象解析

问题是这样出现的:在进行建行B2B网银在线支付时,建行在回调时采用POST方式提交,编码方式为GBK,而我们的系统为ASP.NET,编码UTF-8。通过Request获取的参数是乱码。

题是这

解决办法:从InputStream解析,获取参数。具体代码如下:

[转]建行B2B支付回调参数乱码现象解析
1 IServiceProvider provider = (IServiceProvider)HttpContext.Current;
2 HttpWorkerRequest worker = (HttpWorkerRequest)provider.GetService(typeof(HttpWorkerRequest));
3 byte[] bs = worker.GetQueryStringRawBytes();
4 String queryString = Encoding.GetEncoding("GBK").GetString(bs);
5 NameValueCollection querys = HttpUtility.ParseQueryString(queryString);
6 if (querys != null && querys.Count > 0)
7 {
8 foreach (String key in querys.AllKeys)
9 {
10 if (key == "ACC_NAME")
11 {
12 ACC_NAME = querys[key];
13 }
14
15 if (key == "BRANCH_NAME")
16 {
17 BRANCH_NAME = querys[key];
18 }
19 }
20 }
[转]建行B2B支付回调参数乱码现象解析



本文转自齐师傅博客园博客,原文链接:http://www.cnblogs.com/youring2/archive/2011/03/03/1969527.html,如需转载请自行联系原作者
上一篇:Mysql异常_01_ 誓死登进mysql_Can't connect to MySQL server on 'localhost' (10061)


下一篇:mysql sql优化实例