如何使用C#在http客户端传递内容类型?

时间:2014-03-07 06:31:12

标签: dotnet-httpclient

如何使用C#在http客户端中传递以下内容类型?

multipart/alternative;  
boundary=56CC414C-FDE6-48DB-846C-6A1CEBCD7805;  
type=\"text/plain\"  

1 个答案:

答案 0 :(得分:0)

这样的事情应该有效,

var multipartContent = new MultipartContent("alternative","56CC414C-FDE6-48DB-846C-6A1CEBCD7805");
multipartContent.Add(new StringContent("Here is some content"));

var httpClient = new HttpClient();
httpClient.PostAsync("http://example.org/",multipartContent);