/// <summary> /// 创建md5摘要,规则是:按参数名称a-z排序,遇到空值的参数不参加签名 /// </summary> /// <param name="key">参数名</param> /// <param name="value">参数值</param> /// key和value通常用于填充最后一组参数 /// <returns></returns> public virtual string CreateMd5Sign(string key, string value) { 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 && "".CompareTo(v) != 0 && "sign".CompareTo(k) != 0 && "key".CompareTo(k) != 0) { sb.Append(k + "=" + v + "&"); } } sb.Append(key + "=" + value); string sign = MD5Util.GetMD5(sb.ToString(), GetCharset()).ToUpper(); return(sign); }