1

您好我正在尝试获取 url 的 html 代码(“http://dx.doi.org/10.1038/nclimate1398”),出现以下错误。我已经尝试了该站点中提到的许多方法,但它不起作用。这是我的代码。

它在 Web 浏览器中工作,无需提供 Username 和 Password

dim url as string = "http://dx.doi.org/10.1038/nclimate1398"
Dim myRequest = CType(WebRequest.Create(url), HttpWebRequest)
myRequest.Credentials = System.Net.CredentialCache.DefaultCredentials
myRequest.PreAuthenticate = True
myRequest.AllowAutoRedirect = True
Dim response = myRequest.GetResponse()
Dim responseStream = response.GetResponseStream()
Dim responseReader = New StreamReader(responseStream)
Dim result = responseReader.ReadToEnd()
Return result

我该如何解决?

4

0 回答 0