How to change LAN Settings (proxy configuration) programmatically

后端 未结 5 666
萌比男神i
萌比男神i 2021-02-09 01:11

I am writing a program to automatically switch my proxy address based on the network I am connected to.

I have so far got everything to work except the part that I have

5条回答
  •  长发绾君心
    2021-02-09 01:40

    You can change proxy settings by using the registry. See the following link:
    http://support.microsoft.com/kb/819961

    Key path: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

    Values:

    "MigrateProxy"=dword:00000001
    "ProxyEnable"=dword:00000001
    "ProxyHttp1.1"=dword:00000000
    "ProxyServer"="http://ProxyServername:80"
    "ProxyOverride"=""
    

    A question in SuperUser.com regarding how to disable automatically detect settings in ie proxy configuration. Disable "Automatically detect settings" in IE proxy configuration

    A snippet, taken from Internet Explorer Automatic Configuration Script Definition via Registry.

    Script 1: This enables the AutoConf Script and defines what it is (exchange the http://xxxx with your script)

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
    "AutoConfigURL"="http://xxx.xxx.xxx.xxx.xxxx"
    "ProxyEnable"=dword:00000000
    

    Script 2: This script Disables the AutoConf Script and enables a proxy server with exceptions.

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
    "ProxyEnable"=dword:00000001
    "ProxyOverride"="proxyexceptionname:portnumber;anotherexceptionname:port
    "ProxyServer"="ftp=MyFTPProxy:Port;http=MYHTTPPROXY:PORT;https=MYHTTPSPROXY:PORT
    "AutoConfigURL"=""
    

提交回复
热议问题