WebClient将标头附加到下载的文件

时间:2014-07-18 06:31:18

标签: c# webclient

我试图通过GET从OpenStack下载对象。 这些文件正常下载,除了WebClient在一开始就将标题附加到每一个文件中,如下所示:

-------------------------------28947758029299
Content-Disposition: form-data; name=""; filename="v30fDviSwYNfLlN0-a0D0w9pi.zip"
Content-Type: application/octet-stream

这是我的代码:

WebClient client = new WebClient ();
client.Headers.Set ("X-Auth-Token", OktawaveApi.Token);

// Download progress
client.DownloadProgressChanged += delegate(object sender, DownloadProgressChangedEventArgs e) {
    progressCallback (e.ProgressPercentage);
};

// Download completed.
client.DownloadFileCompleted += delegate(object sender, System.ComponentModel.AsyncCompletedEventArgs e) {
    completeCallback (true);
};

client.DownloadFileAsync (new Uri(OktawaveApi.StorageURL + "/" + parent.Name + "/" + Name), targetPath);

有没有办法解决这个问题?

0 个答案:

没有答案