This was suppose to be a simple task,what i wanna do is download a file lets say https://www.onlinesubmit.in/people-computers.jpg but the original file has limited to view in a particular region so i have to use a proxy service and i am using https://www.proxy-service.de/
so the complete link becomes https://www.proxy-service.de/proxy-s...&b=0&f=norefer
now i have to download it by my app not via web-browser,
when i try
this works fine but if i change the Uri to https://www.proxy-service.de/proxy-s...&b=0&f=norefer this don't work as may be proxy site doesn't support hotlinking.Code:Dim myclient As New WebClient Dim url As Uri = New Uri("https://www.onlinesubmit.in/people-computers.jpg") myclient.DownloadFileAsync(url, "pic.jpg")
so i google a bit and found some code which says i have to use
for HTTP andCode:System.Net.WebProxy("http://proxy-service.de", True)
for HTTPSCode:System.Net.WebProxy("proxy-service.https.de",443)
so i try to write some code
and it's not working,it simply creates a blank jpg file and the exception as per error.txt isCode:Try Dim proxy As New System.Net.WebProxy("proxy-service.https.de", 443) proxy.Credentials = New System.Net.NetworkCredential("userId", "password", "Domain") Dim URI As String = "https://www.onlinesubmit.in/people-computers.jpg" Dim oRequest As System.Net.HttpWebRequest = CType(System.Net.HttpWebRequest.Create(URI), System.Net.HttpWebRequest) oRequest.Proxy = proxy Using oResponse As System.Net.WebResponse = CType(oRequest.GetResponse, System.Net.WebResponse) Using responseStream As IO.Stream = oResponse.GetResponseStream Using fs As New IO.FileStream("Downloaded_file.jpg", FileMode.Create, FileAccess.Write) Dim buffer(2047) As Byte Dim read As Integer Do read = responseStream.Read(buffer, 0, buffer.Length) fs.Write(buffer, 0, read) Loop Until read = 0 responseStream.Close() fs.Flush() fs.Close() End Using responseStream.Close() End Using oResponse.Close() End Using Catch ex As Exception File.WriteAllText("error.txt", ex.ToString) End Try
And now i am clue less,please help anybody anything?System.Net.WebException: The remote name could not be resolved: 'proxy-service.https.de'
at System.Net.HttpWebRequest.GetResponse()
at dummy_proj.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\dummy_proj\dummy_proj\Form1.vb:line 13![]()


Reply With Quote
ort proxy instead of a web proxy
