我正在嘗試使用webclient從codeplex.com下載文件。我可以下載一個文件,但它最終不是.zip而是html文件。看起來他們有一個重定向到下載文件的腳本。使用asp.net webclient自動從codeplex.com下載
任何人都有這方面的經驗?
這裏是我的代碼:
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Download_Click(object sender, EventArgs e)
{
WebClient webClient = new WebClient();
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
webClient.DownloadFileAsync(new Uri("http://dotnetnuke.codeplex.com/downloads/get/815672"), @"C:\DNN_Platform_07.02.02_Install.zip");
}
private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
progressBar.Value = e.ProgressPercentage;
}
private void Completed(object sender, AsyncCompletedEventArgs e)
{
txtStatus.Text("Download completed!");
}
要下載的zip文件? – voddy
是的,我想下載郵編 – Asmussen