c# – 检测默认Web浏览器的代理设置
发布时间:2020-12-15 08:13:01 所属栏目:百科 来源:网络整理
导读:MSDN样本 HttpWebRequest myWebRequest=(HttpWebRequest)WebRequest.Create("http://www.microsoft.com");WebProxy myProxy=new WebProxy();// Obtain the 'Proxy' of the Default browser. myProxy=(WebProxy)myWebRequest.Proxy; 不行. 我得到的错误是:无
MSDN样本
HttpWebRequest myWebRequest=(HttpWebRequest)WebRequest.Create("http://www.microsoft.com"); WebProxy myProxy=new WebProxy(); // Obtain the 'Proxy' of the Default browser. myProxy=(WebProxy)myWebRequest.Proxy; 不行. 我有什么选择? 解决方法
HttpWebRequest.Proxy返回
IWebProxy接口,而不是WebProxy.改变它,它会起作用.
您还可以使用WebRequest.DefaultWebProxy或WebRequest.GetSystemWebProxy()获取代理详细信息,而不是使用HttpWebRequest并从中获取代理. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |