C# auto detect proxy settings

后端 未结 8 734
遇见更好的自我
遇见更好的自我 2020-12-01 06:37

C# 2008 SP1

I am using the code to detect if a proxy has been set under \"Internet Options\". If there is a proxy then I will set this in my webclient.

So I

8条回答
  •  情深已故
    2020-12-01 07:23

    WebClient etc use the WinHTTP settings (not the IE settings), so the easiest thing to do is to configure WinHTTP! On XP etc you can use:

    proxycfg -u
    

    to import the current IE settings into the WinHTTP store. After that, WebClient etc should be able to use the same settings without issue. On Vista and Windows 7 this is now found under:

    netsh winhttp import proxy ie
    

    You need to run this as administrator.

提交回复
热议问题