启用/禁用代理应用程序不能正常使用IE浏览器 [英] Enabling/disabling proxy app doesn't work properly with IE

查看:267
本文介绍了启用/禁用代理应用程序不能正常使用IE浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常奇怪的情况在这里:我已经写了一个应用程序,除其他事项外,交换机连接代理从开到关和其他方式轮。它是通过改变在注册表中的值来完成:

I have a really strange situation here: I've written an app that, among other things, switches connections' proxy from on to off and the other way round. It is done by changing the value in the registry:

public void SetUpProxy(string proxy, bool enable)
{
    RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
    if (proxy != null)
        key.SetValue("ProxyServer", proxy);
    key.SetValue("ProxyEnable", enable ? 1 : 0);
    key.Close();
}

当我请求让我的应用程序代理它做的第一件事就是连接到FTP服务器,下载一个文件,然后启用代理服务器(下载不会对代理工作)。一切工作完全正常 - 直到我启动Internet Explorer
。 例如:如果我开始我的应用程序,让它启用代理,然后让它禁用代理 - 一切工作正常。但是,如果我启用代理,,然后启动IE浏览器,禁用代理,并尝试启用了一遍这是行不通的 - 应用程序无法连接到FTP服务器,因为在某种程度上它使用代理服务器,即使在价值注册表是0!
我希望我设法正确地解释它。我的问题是:为什么会发生的事情,我怎么能解决这个问题?

When I request enabling the proxy in my app the first thing it does is to connect to ftp server, download a file, THEN enable the proxy (downloading wouldn't work with the proxy on). Everything works perfectly fine - until I launch Internet Explorer.
For example: if I start my app, let it enable the proxy, then let it disable the proxy - everything works fine. But if I enable the proxy, then launch IE, disable proxy and try enabling it again it doesn't work - the app cannot connect to the ftp server because somehow it uses proxy, even though the value in the registry is 0!
I hope I managed to explain it properly. My question is: why is it happening and how can I fix this?

编辑:我使用WebClient类下载文件。我发现,client.Proxy.GetProxy(myUri)返回指定的URI时,塔应用程序运行正常,butwhen我打开IE浏览器更改为HTTP:// theUriFromIE。

I'm using WebClient class to download the file. I've found out that client.Proxy.GetProxy(myUri) returns the specified Uri when tha app runs fine, butwhen I open IE it changes to "http://theUriFromIE".

推荐答案

简单的设置Web客户端的代理服务器属性设置为null帮助。

Simply setting WebClient's Proxy property to null helped.

这篇关于启用/禁用代理应用程序不能正常使用IE浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆