0
我想使用代理服務器ips列表使httpwebrequests,但每次我提出請求時,我收到一條錯誤消息:無法連接到遠程服務器。使用代理服務器進行httpwebrequest失敗
這裏是我的代碼的示例:
Dim request as HttpWebRequest = WebRequest.Create(url)
Dim oldProxy as IWebProxy = CType(request.Proxy, IWebProxy)
Dim proxy as New WebProxy()
Dim newuri as new Uri("http://" & proxyIP)
proxy.Address = newuri
request.Proxy = proxy
request.Proxy.Credentials = CredentialCache.DefaultCredentials
Try
request.Timeout=18000
request.UserAgent = useragent
request.KeepAlive = False
**webreponse = tryCast(request.GetResponse(), HttpWebResponse)**
request.accept="*/*"
...
它未能在request.getresponse線之上。任何想法讚賞。