Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Using proxies with a web browser.

Just thought I'd release this as it may come in handy to people.

This is not my code!

Code
<Runtime.InteropServices.DllImport("wininet.dll", SetLastError:=True)> _
    Private Shared Function InternetSetOption(ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, ByVal lpdwBufferLength As Integer) As Boolean
    End Function

    Public Structure Struct_INTERNET_PROXY_INFO
        Public dwAccessType As Integer
        Public proxy As IntPtr
        Public proxyBypass As IntPtr
    End Structure

    Private Sub UseProxy(ByVal strProxy As String)
        Const INTERNET_OPTION_PROXY As Integer = 38
        Const INTERNET_OPEN_TYPE_PROXY As Integer = 3

        Dim struct_IPI As Struct_INTERNET_PROXY_INFO

        struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY
        struct_IPI.proxy = Marshal.StringToHGlobalAnsi(strProxy)
        struct_IPI.proxyBypass = Marshal.StringToHGlobalAnsi("local")

        Dim intptrStruct As IntPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(struct_IPI))

        Marshal.StructureToPtr(struct_IPI, intptrStruct, True)

        Dim iReturn As Boolean = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI))
    End Sub


USAGE:
Code
UseProxy("IP:PORT")
            WebBrowser1.Navigate("LINK")
Nice C+Ping the Code from youtube
If you gonna post something make it your code
not someone elses !
(Oct 17, 2014 03:52 PM)Zeivu~ Wrote:  Nice C+Ping the Code from youtube
If you gonna post something make it your code
not someone elses !
If I want to post something, then I will. Someone may find this useful.
Copy and pasting code and not giving credits is not good.
Please leave this section if this is all you are going to do.
(Oct 24, 2014 08:14 AM)WZDY Wrote:  Some people might actually find this handy.
No reason to hate as the OP said that this wasn't by him.

Anyways, thanks for sharing.
Exactly. Thank you for appreciating the share.

I found this on Google somewhere and couldn't find it on here, hence the reason I posted it.
Thanks for the share OP. It might be helpful.
Spoiler (Click to View)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by Camf ∆Nov 10, 2019 05:36 PM 2 183 Nov 10, 2019 05:36 PM
Last Post: Eternal Darkness
[.NET] by infomihoMar 17, 2014 02:05 AM 89 3,413 Mar 17, 2014 02:05 AM
Last Post: programtesting28
[.NET] by IngenuityOct 20, 2013 05:17 PM 27 1,432 Oct 20, 2013 05:17 PM
Last Post: Ingenuity