如何通过代码更改代理服务器

时间:2022-09-02 12:14:28

To change Proxy server I have to go to IE->Internet Options->LAN Settings and click on "Use a proxy server for your LAN". I am sure there is some way of doing that by code. Does anybody has any idea how to do it (C#)?

要更改代理服务器,我必须转到IE-> Internet选项 - >局域网设置,然后单击“为LAN使用代理服务器”。我确信有一些方法可以通过代码来实现。有没有人知道怎么做(C#)?

Thanks a lot.

非常感谢。

Sincerely, Vlad

2 个解决方案

#1


What if you were to make a batch file, and then create a shortcut to it on your desktop, and then hotlink to it with something like ctrl+alt+n

如果您要创建批处理文件,然后在桌面上创建它的快捷方式,然后使用ctrl + alt + n之类的热链接到它,该怎么办?

And the batch looked like this:

批处理看起来像这样:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxyEnable"=dword:00000001 "ProxyServer"="10.22.40.6:3128"

[HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings]“ProxyEnable”= dword:00000001“ProxyServer”=“10.22.40.6:3128”

#2


If you want to setup the proxy for use by your code you can set it via the GlobalProxySelection.Select property.

如果要设置代理以供代码使用,可以通过GlobalProxySelection.Select属性进行设置。

However Microsoft does not recommend setting the proxy manually and recommends always using the default proxy.

但是,Microsoft建议不要手动设置代理,并建议始终使用默认代理。

#1


What if you were to make a batch file, and then create a shortcut to it on your desktop, and then hotlink to it with something like ctrl+alt+n

如果您要创建批处理文件,然后在桌面上创建它的快捷方式,然后使用ctrl + alt + n之类的热链接到它,该怎么办?

And the batch looked like this:

批处理看起来像这样:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxyEnable"=dword:00000001 "ProxyServer"="10.22.40.6:3128"

[HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings]“ProxyEnable”= dword:00000001“ProxyServer”=“10.22.40.6:3128”

#2


If you want to setup the proxy for use by your code you can set it via the GlobalProxySelection.Select property.

如果要设置代理以供代码使用,可以通过GlobalProxySelection.Select属性进行设置。

However Microsoft does not recommend setting the proxy manually and recommends always using the default proxy.

但是,Microsoft建议不要手动设置代理,并建议始终使用默认代理。