Exemplo n.º 1
0
        /// <summary>
        /// 現在の WinINet セッションのプロキシ設定を適用
        /// </summary>
        /// <param name="proxy">プロキシサーバー</param>
        /// <param name="proxyBypass">バイパスリスト</param>
        public static void SetProxyForCurrentSession(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);
        }
Exemplo n.º 2
0
 internal static extern int UrlMkSetSessionOption(
     INTERNET_OPTION dwOption,
     INTERNET_PROXY_INFO pBuffer,
     uint dwBufferLength,
     uint dwReserved);