PDA

View Full Version : حرفه ای: عبور از PROXY SERVER با VB.NET



mhmm2005
جمعه 16 مهر 1389, 20:15 عصر
با چه كدي در vb.net ميشه از پروكسي سرور عبور كرد؟
من كد زير رو دارم ولي باز هم error 407 ميده
مشكل از كجاست؟


Dim dldata As String = Nothing
Dim client As System.Net.WebClient = New System.Net.WebClient()

If My.Settings.UseProxy = True Then
Dim pip As String = My.Settings.ProxyIP.ToString()
Dim pp As Integer = My.Settings.ProxyPort
Dim pname As String = My.Settings.ProxyName.ToString()
Dim ppw As String = DecodePW(2)
Dim cproxy As New System.Net.WebProxy(pip, pp)

Dim cred As New NetworkCredential(pname, ppw, pip)
cproxy.Credentials = cred

client.Proxy = cproxy data = client.DownloadData("http://www.oursite.com/ourfile.txt")

Else
data = client.DownloadData("http://www.oursite.com/ourfile.txt")
End If

client.Dispose() dldata = System.Text.Encoding.ASCII.GetString(data)