Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim imageAddress As String = String.Empty
Dim filename As String = String.Empty
Try
Dim fileReader As New WebClient()
Dim proxy As IWebProxy = New WebProxy("proxy adress", port number)
proxy.Credentials = New NetworkCredential("network userid", "network password")
imageAddress = "http://wwwimages.adobe.com/content/dam/Adobe/en/products/acrobat/pdfs/adobe-acrobat-xi-esign-pdf-file-tutorial-ue.pdf"
filename = imageAddress.Substring(imageAddress.LastIndexOf("/") + 1)
If Not (System.IO.File.Exists("D:\" + filename)) Then
fileReader.DownloadFile(imageAddress, "D:\" + filename)
End If
Catch ex As HttpListenerException
MsgBox("Error accessing " + imageAddress + " - " + ex.Message)
Catch ex As Exception
MsgBox("Error accessing " + imageAddress + " - " + ex.Message)
End Try
End Sub
以上代码抛出错误407:需要代理身份验证。我似乎不理解我的代码的问题。任何帮助表示赞赏。谢谢提前