Get IE's default proxy with DefaultWebProxy

后端 未结 1 927
情书的邮戳
情书的邮戳 2020-12-19 18:02

I\'ve read through pretty much all the documentation I can find but I\'m yet to find a simple working example of how to get IE\'s default proxy settings using DefaultW

相关标签:
1条回答
  • 2020-12-19 18:35

    WebRequest.DefaultWebProxy implements the IWebProxy interface. You can use the GetProxy method to get the proxy's URI:

    var uri = WebRequest.DefaultWebProxy.GetProxy(new Uri("http://www.google.com"));
    

    Response to a comment:

    You need to pass the uri to GetProxy because that's how Microsoft implemented it...

    Seriously, I believe this is so because you can configure the browser to bypass the proxy for some addresses. If you pass one of this bypassed addresses, you will probably get a different result.

    0 讨论(0)
提交回复
热议问题