コード例 #1
0
ファイル: RequestHandler.cs プロジェクト: qaz734913414/CRL2
        public virtual string getRequestURL()
        {
            this.createSign();
            StringBuilder builder = new StringBuilder();
            ArrayList     list    = new ArrayList(this.parameters.Keys);

            list.Sort();
            foreach (string str in list)
            {
                string instr = (string)this.parameters[str];
                if (((instr != null) && ("key".CompareTo(str) != 0)) && ("spbill_create_ip".CompareTo(str) != 0))
                {
                    builder.Append(str + "=" + TenpayUtil.UrlEncode(instr, this.getCharset()) + "&");
                }
                else if ("spbill_create_ip".CompareTo(str) == 0)
                {
                    builder.Append(str + "=" + instr.Replace(".", "%2E") + "&");
                }
            }
            if (builder.Length > 0)
            {
                builder.Remove(builder.Length - 1, 1);
            }
            return(this.getGateUrl() + "?" + builder.ToString());
        }
コード例 #2
0
        /** 获取带参数的请求URL  @return String */
        public virtual string getRequestURL()
        {
            this.createSign();

            StringBuilder sb    = new StringBuilder();
            ArrayList     akeys = new ArrayList(parameters.Keys);

            akeys.Sort();
            foreach (string k in akeys)
            {
                string v = (string)parameters[k];
                if (null != v && "key".CompareTo(k) != 0)
                {
                    sb.Append(k + "=" + TenpayUtil.UrlEncode(v, getCharset()) + "&");
                }
            }

            //去掉最后一个&
            if (sb.Length > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }

            return(this.getGateUrl() + "?" + sb.ToString());
        }