在运行下面的代码时我得到了#34;远程服务器返回了一个错误:(407)需要代理验证。"问题。我做了很多RND,但仍面临同样的问题...
代码:
Private Sub btnDownload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDownload.Click
Application.DoEvents()
Dim web_client As WebClient = New WebClient
Try
web_client.UseDefaultCredentials = True
web_client.DownloadFile(txtRemoteFile.Text, txtLocalFile.Text)
MessageBox.Show("Done")
Catch ex As Exception
Dim wp As WebProxy
wp = New WebProxy("ProxyIP", ProxyPort)
wp.Credentials = New NetworkCredential("LoginName", "Password", "DomainName")
web_client.Proxy = wp
web_client.DownloadFile(txtRemoteFile.Text, txtLocalFile.Text)
MessageBox.Show("Done")
End Try
End Sub
提前致谢...