私はhttp://ww.url.com/page?id=200という形式のURLを持っています。これにより、10 MBのファイルがダウンロードされます。しかし、私は常にe.ProgressPercentageを0にしています。実際の結果を読み込んでupload done関数を実行しています。WebClientのDownloadAsyncDataが失敗します
ここで間違っていることを教えてください。
私はん。ContentLength応答のヘッダに戻さに
private void button1_Click(object
sender, EventArgs e)
{
WebClient webClient = new WebClientEx();
webClient.DownloadProgressChanged +=
new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged);
webClient.DownloadDataCompleted += new
DownloadDataCompletedEventHandler(wc_DownloadComplete);
webClient.DownloadDataAsync(new Uri("http://ww.url.com/page?id=200"));
}
public void wc_DownloadProgressChanged(Object sender,
DownloadProgressChangedEventArgs e)
{
Progress1.Value = e.ProgressPercentage; // this is 0
}
public void wc_DownloadComplete(Object sender,DownloadDataCompletedEventArgs e)
{
int a = 0;
this.Close();
}
} }
多分それはあなたのフォーマット(によって引き起こされています - :) –
と注意:あなたのCompletedEventはerrorhandling欠けています。 –