我正在使用 Visual Studio Express 2012 RC 为 Windows 8 设计我的 Metro 风格应用程序。
过去,我为 windows phone 开发了一个应用程序,我曾经在其中webclient.uploadstringasync
将字符串数据发布到服务器。但由于webclient
Windows 8 不存在,我正在寻找它的替代方案。
我尝试使用httpclient.postasync
但它不起作用(不知道为什么)。
谁能建议我该怎么做。请解释您建议的任何方法并尝试举例说明。我是 C# 的初学者,所以任何帮助都会起作用。谢谢
这是我使用httpclient.postasync
但没有工作的代码示例(不知道为什么)。
HttpClient data=new HttpClient();
HttpContent post;
async private void buttonupdate_Click(object sender, RoutedEventArgs e)
{
post=new StringContent("I put the string here which is to be posted");
await data.PostAsync(URI,post);
}