//向服务器发送POST数据
public static string Post(string URL, Hashtable para)
{
WebClient webClient = new WebClient();
NameValueCollection postValues = new NameValueCollection();
//拼接参数
foreach (DictionaryEntry de in para)
{
postValues.Add(de.Key.ToString(), de.Value.ToString());
}
//向服务器发送POST数据
byte[] responseArray = webClient.UploadValues(URL, postValues);
return Encoding.UTF8.GetString(responseArray);
}
public static string Post(string URL, Hashtable para)
{
WebClient webClient = new WebClient();
NameValueCollection postValues = new NameValueCollection();
//拼接参数
foreach (DictionaryEntry de in para)
{
postValues.Add(de.Key.ToString(), de.Value.ToString());
}
//向服务器发送POST数据
byte[] responseArray = webClient.UploadValues(URL, postValues);
return Encoding.UTF8.GetString(responseArray);
}