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

.NET 

[Snippet] Proxy for Webbrowser [VB.net]

Alot of people were requesting the proxy class for a webbrowser in vb.net, so here it is:

PHP Code

<?php 
Public Structure Struct_INTERNET_PROXY_INFO
  
Public dwAccessType As Integer
  
Public proxy As IntPtr
  
Public proxyBypass As IntPtr
    End Structure
    
<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

    Private 
Sub PROXYSET(ByVal strProxy As String)
  
WebBrowser1.ScriptErrorsSuppressed = True
  
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 = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(strProxy)
  
struct_IPI.proxyBypass = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("local")
  
Dim intptrStruct As IntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI))
  
System.Runtime.InteropServices.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 

And this is how you use it:
PHP Code

<?php 
Dim proxy 
as string = "Insert you're proxy here"
PROXYSET(proxy) 

Activate it before you run you're webbrowser, so like this:
PHP Code

<?php 
Dim proxy 
as string = "123.123.123.123:80"
PROXYSET(proxy)
Webbrowser1.navigate("https://hackforums.net") 

Feedback appreciated!

This is not made by me! I'm just sharing it with you guys 🤝
Thanks! Worked like a charm!
Really nice, thanks for the sharing.
nice but already post here....^^
No problem guys ^^ 25 chars :P
Thanks for sharing mate. :)

-Disguize
"HF Oldfag est. '08."
Good share thanks for this.
Thanks alot for you're support ^^
Thanks for this mate, I have a question:

PHP Code

<?php 
Dim proxy 
as string = "123.123.123.123:80"
PROXYSET(proxy)
Webbrowser1.navigate("https://hackforums.net") 

Instead of "123.123.123.123:80" could you put (Textbox1.Text) and there be a list of proxies in TextBox1? And the equivalent for the link
@Kandor of course you can. How to pump a old thread.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by еlixirSep 9, 2022 06:31 AM 0 132 Sep 9, 2022 06:31 AM
Last Post: еlixir
[.NET] by D3ath_GuNJan 3, 2020 01:49 PM 4 251 Jan 3, 2020 01:49 PM
Last Post: Krysis
[Python] by datguy.devNov 28, 2019 10:37 PM 4 296 Nov 28, 2019 10:37 PM
Last Post: Eternal Darkness