【发布时间】:2014-08-08 13:39:04
【问题描述】:
我正在运行以下代码来检查网站的排名代码。在我的国家禁止该网站之前,此代码运行良好。现在,如果我在我的电脑上使用代理或 VPN,它工作正常。那么如何在 PC 的默认代理设置上在该应用中设置手动代理(来自 TheBannedSite.com 和端口的代理)。
代码:
Try
Dim str As String = New WebClient().DownloadString((url))
Dim pattern = "When asked enter the code: <font color=blue>(\d{5,})\s<\/font>"
Dim r = New Regex(pattern, RegexOptions.IgnoreCase)
Dim m As Match = r.Match(str)
If m.Success Then
FlatLabel1.Text = "Code:: " + m.Groups(1).ToString()
m = m.NextMatch()
'Captcha1.Refresh()
Else
FlatLabel1.Text = "Please Check ur Network Connection First !!"
End If
Catch
Interaction.MsgBox("Please Check ur Network Connection First !! ", MsgBoxStyle.Information, "Error")
End Try
我尝试了以下代码:
Dim str As New System.Net.WebClient
str.Proxy = System.Net.HttpWebRequest.DefaultWebProxy
Dim Coder As String = str.DownloadString((url))
但它设置了我的电脑的 dafult 代理。 我要手动代理...
【问题讨论】: