上传文件与.NET的Windows应用商店应用程序

问题描述:

现在,我来,我不能正常使用 .NET 来写我的Windows应用商店的应用程序,我试图涉水通过的混乱,是实现 .NET 的Windows应用商店的应用程序。我的最新发现是, System.Net.WebClient 类缺少,我需要用它来上传文件。假如这个类在那里,我会做线沿线的东西:

Now that I have come to the realization that I can not use the normal .NET to write my Windows Store apps, I am trying to wade through the mess that is .NET for Windows Store apps. My latest discovery is that the System.Net.WebClient class is missing, and I needed to use it to upload a file. Had this class been there, I would have done something along the lines of:

webClient.UploadFile("http://my.website/upload.php?a=" + someParam, "POST", filepath);

不幸的是,我不能在.NET的Windows应用商店做到这一点。我将如何实现只用了Windows应用商店.NET类似的功能?

Unfortunately, I can't do this in .NET for windows store. How would I achieve a similar functionality using only .NET for windows store?

我想尝试的HttpClient类 - 的 http://msdn.microsoft.com/en-us/library/system.net.http.httpclient.aspx - 它有Post方法,如果你看这个答案enter这里链接的描述,它展示了如何创建多部分数据文件上传。

I'd try HttpClient class - http://msdn.microsoft.com/en-us/library/system.net.http.httpclient.aspx - it has Post method, and if you look at this answerenter link description here, it shows how to create multipart data for file upload.