没有人帮解决啊~~~好失望ing
我用了与楼主类似的程序,同样遇到“在webclient请求期间发生错误”,请教楼主是怎么解决的?或者哪位高手指点下?谢谢!
public void ThreadOne()
{
button1.Enabled = false;
string Url = textBox2.Text;
int n = Url.LastIndexOf('/');
string UrlAddress = Url.Substring(0, n);
string fileName = Url.Substring(n + 1, Url.Length - n - 1);
string Dir = textBox1.Text;
string Path = Dir + "\\" + fileName;
try
{
WebRequest myre = WebRequest.Create(UrlAddress);
}
catch (WebException exp)
{
MessageBox.Show(exp.Message, "Error");
}
try
{
statusBar1.Text = "下载文件......";
//
// 在webclient请求期间发生错误。
// WebClient 不支持并发 I/O 操作。
//
client.DownloadFile(UrlAddress, Path);
statusBar1.Text = "下载完毕";
}
catch (WebException exp)
{
MessageBox.Show(exp.Message, "Error");
statusBar1.Text = "";
}
button1.Enabled = true;
}