public static void SetProxyInProcess(string proxy, string proxyBypass) { var proxyInfo = new INTERNET_PROXY_INFO { dwAccessType = INTERNET_OPEN_TYPE.INTERNET_OPEN_TYPE_PROXY, lpszProxy = proxy, lpszProxyBypass = proxyBypass }; var dwBufferLength = (uint)Marshal.SizeOf(proxyInfo); NativeMethods.UrlMkSetSessionOption(INTERNET_OPTION.INTERNET_OPTION_PROXY, proxyInfo, dwBufferLength, 0U); }
internal static extern int UrlMkSetSessionOption( INTERNET_OPTION dwOption, INTERNET_PROXY_INFO pBuffer, uint dwBufferLength, uint dwReserved);