本文介绍了无法访问IE代理设置C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好, 我正在尝试为C#中的阅读IE代理设置提供解决方案。我需要阅读所有选项,自动检测设置,自动配置URL和手动代理设置。 1)我尝试使用Interop Services - WinHTTP.DLL,它确实有效,但我应该只使用C#的东西 2)我尝试了同样的阅读注册表,并取得了成功,但我不应该使用这个解决方案。 3)我尝试使用System.Net.Configuration,但我无法使用代码获取默认的系统代理设置: - // System.Net.Configuratiion System。 Net.Configuration.ProxyElement proxyConf = new ProxyElement(); //proxyConf.UseSystemDefault = ProxyElement.UseSystemDefaultValues.True; if(proxyConf.AutoDetect == ProxyElement.AutoDetectValues.True) Console .WriteLine(" Auto detect Proxy"); if(proxyConf.ScriptLocation!= null) { Console.WriteLine(" Auto Config Script"); Console.WriteLine(proxyConf) .ScriptLocation); } if(proxyConf.ProxyAddress!= null) { Console.WriteLine(proxyConf.ProxyAddress); } 它根本没有为我获取系统设置。 3)我尝试过System.Web.Configuration,但仍然没用。 4 )我不能使用Webbrowser控件。 我该怎么做。任何帮助woul; d非常感谢 解决方案 Hi All,I am currently trying to workout a solution for Reading IE Proxy settings in C#. I need to read all the option, automatically detect settings , Autoconfiguration url and manual proxy settings.1) I tried using Interop Services - WinHTTP.DLL, it did work, but I am supposed to use only C# stuff2) I tried reading registry fro the same, and was successful, but iam not supposed to use thsi solution. 3) I tried using System.Net.Configuration, but the I cannot fetch the default System Proxy settings using the code :-  //System.Net.Configuratiion            System.Net.Configuration.ProxyElement proxyConf = new ProxyElement() ;             //proxyConf.UseSystemDefault = ProxyElement.UseSystemDefaultValues.True;            if ( proxyConf.AutoDetect == ProxyElement.AutoDetectValues.True )                Console.WriteLine("Auto detect Proxy");            if (proxyConf.ScriptLocation != null)            {                Console.WriteLine(" Auto Config Script");                Console.WriteLine(proxyConf.ScriptLocation);            }            if (proxyConf.ProxyAddress != null)            {                Console.WriteLine(proxyConf.ProxyAddress);            }It simply does not fetch the system settings for me.3) I tried System.Web.Configuration, but still no use.4) I cannot use Webbrowser control.How do I do it.Any help woul;d be greatly appreciated 解决方案 这篇关于无法访问IE代理设置C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-12 20:41