C# WebApi将查询字符串RequestUri.Query解析转换为Hashtable
C# WebApi将查询字符串RequestUri.Query解析转换为Hashtable string query = this.Request.RequestUri.Query;
//判断参数
if (String.IsNullOrEmpty(query) || query.Length < 10)
return new ModelResponse { Code = -1, Message = "notify_url参数错误!" };
//去掉问号?,第1个字符
query = query.Replace("?", "");
string[] items = query.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries);
string[] values;
Hashtable ht = new Hashtable();
foreach (string item in items)
{
values = item.Split('=');
ht.Add(values[0], values[1]);