Advertisement
BaSs_HaXoR

Proxy in C# Webbrowser

Oct 19th, 2014
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. //Credits: Rogue: http://thebot.net/threads/c-changing-proxy-in-webbrowser-control.135271/
  2.  
  3. void RefreshIESettings(string strProxy) {
  4.         const int INTERNET_OPTION_PROXY = 38;
  5.         const int INTERNET_OPEN_TYPE_PROXY = 3;
  6.         Struct_INTERNET_PROXY_INFO s_IPI;
  7.         s_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY;
  8.         s_IPI.proxy = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(strProxy);
  9.         s_IPI.proxyBypass = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("Global");
  10.         IntPtr intptrStruct = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(s_IPI));
  11.         System.Runtime.InteropServices.Marshal.StructureToPtr(s_IPI, intptrStruct, true);
  12.         InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(s_IPI));
  13.     }
  14.  
  15. RefreshIEsettings();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement