Hack Forums
[.NET] [Downloader] Using Proxy(s) - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [Downloader] Using Proxy(s) (/showthread.php?tid=369874)



[Downloader] Using Proxy(s) - The-One - Apr 16, 2010

Here you go:
Code
Imports System.Net
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  If TextBox1.Text.Contains("http://www.#.com/") Then
    Dim IP As String = "xxx.xx.xxx.xx" ' Proxy IP
    Dim Port As Integer = "80" ' Proxy Port
    Dim wc As New WebClient ' WebClient
    Dim Proxy As New WebProxy(IP & ":" & Port, True) ' Set Proxy as WebProxy
    wc.Proxy = Proxy ' WebClient(.Proxy) = WebProxy
    wc.DownloadFile("www.#.com", "AvastBlantiBierus") ' Download the file
  Else
    MsgBox("Must be a valid # link")
  End If
  If TextBox2.Text = "" Then ' If 2nd text (Link) is empty
    ' Nothing, because there isnt need for a seccond download
  Else ' if it is
    If TextBox2.Text.Contains("http://www.#.com/" then
    Dim IP1 As String = "xxx.xx.xxx.xx" ' New Proxy IP
    Dim Port1 As String = "80" ' New Proxy Port
    Dim wc1 As New WebClient ' New WebClient
    Dim Proxy1 As New WebProxy(IP1 & ":" & Port1, True) ' Set Proxy as WebProxy
    wc1.Proxy = Proxy1 ' WebClient(.Proxy) = WebProxy
    wc1.DownloadFile("www.#.com", "NortonBlantiBierus") 'Download the file
    Else
    MsgBox("Must be a valid # link")
    End If
  End If
    End Sub
End Class

You can easy make a function, to read out some proxys from .txt and use them, this whas just for testing.


* - Fake. - Apr 16, 2010

Thanks for this, should be useful :D


* - The-One - Apr 16, 2010

(Apr 16, 2010 05:00 AM)jacktheripper Wrote:  Thanks for this, should be useful :D

Np. Glad i'd helped.


* - Panagiota - Apr 16, 2010

Unique.
Thanks for sharing.


* - TehShrink - Apr 16, 2010

Thanks for this, I was planning on doing something with proxys ages ago, might try again.


* - The-One - Apr 16, 2010

(Apr 16, 2010 05:05 AM)UNd3ad Wrote:  Unique.
Thanks for sharing.

No Problem.

(Apr 16, 2010 05:17 AM)TehShrink Wrote:  Thanks for this, I was planning on doing something with proxys ages ago, might try again.

No problem, good luck with it :)


* - D.O.A - Apr 16, 2010

Awesome Keep it up :D


* - The-One - Apr 16, 2010

(Apr 16, 2010 05:42 AM)D.O.A Wrote:  Awesome Keep it up :D

No problem.

Spoiler (Click to View)


* - accountcanberemoved - Apr 30, 2010

:)) Hehe, I made a new POCMania banner. WIll show it in Graphic section!


* - ๖ۣۜBlueAce™ - Apr 30, 2010

thnx.. that is useful.. 🤝


* - codepoet - Apr 30, 2010

very nice man...thanks


* - Diebspiel - Apr 30, 2010

Dim Port As String = "80" ' Proxy Port

The port is always an integer..

so:

Dim Port As Integer = 80 ' Proxy Port


* - iKorkSkalle - Apr 30, 2010

Thank you, great post!

Spoiler (Click to View)


* - Mark Webber's B1tch - Apr 30, 2010

Great job mate..

This will definitely come in handy sometime..

Thanks for sharing.