Ejemplo n.º 1
0
        protected override void OnNavigated(WebBrowserNavigatedEventArgs e)
        {
            base.OnNavigated(e);

            // 恢复原始的连接选项
            WinINet.RestoreConnectionProxy(currentInternetSettings);
        }
Ejemplo n.º 2
0
        protected override void OnNavigating(WebBrowserNavigatingEventArgs e)
        {
            base.OnNavigating(e);

            // 备份现有的连接选项。
            currentInternetSettings = WinINet.BackupConnectionProxy();

            // 设置或激活代理
            if (Proxy != null && !string.IsNullOrEmpty(Proxy.Address))
            {
                WinINet.SetConnectionProxy(Proxy.Address);
            }
            else
            {
                WinINet.DisableConnectionProxy();
            }
        }