如何在.net中模拟post方式提交json数据
展开全部
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "application/json";
request.Method = "Post";
byte[] data = Encoding.ASCII.GetBytes(json);
using (Stream stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
request.GetResponse();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询