标签:
/// <summary>
/// http请求post数据
/// </summary>
/// <param name="postData">数据</param>
/// <param name="url">url</param>
private void httppostdata(string postData, string url)
{
WebRequest request = WebRequest.Create(url);
request.Method = "Post";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = string.IsNullOrWhiteSpace(postData) ? 0 : Encoding.UTF8.GetByteCount(postData);
StreamWriter sw = new StreamWriter(request.GetRequestStream(), new UTF8Encoding(false));
sw.Write(postData);
sw.Flush();
sw.Dispose();
sw.Close();
}
标签:
原文地址:http://www.cnblogs.com/change4now/p/5665230.html