C#代码实现对HTTP POST参数进行排序

 private static string GetSortedParas(Dictionary<string, string> dic)
{
dic = dic.OrderBy(key => key.Key).ToDictionary(keyItem => keyItem.Key, valueItem => valueItem.Value);
var sbPara = new StringBuilder();
foreach (var para in dic.Where(para => !para.Value.IsNullOrWhiteSpace()))
{
sbPara.AppendFormat("{0}={1}&", para.Key, para.Value);
}
return sbPara.ToString().TrimEnd('&');
}

C#代码实现对HTTP POST参数进行排序

上一篇:SSL证书安装(Tomcat)腾讯云服务器


下一篇:UTF-8 BOM(EF BB BF)