L
L
lysakov2015-09-13 08:32:30
.NET
lysakov, 2015-09-13 08:32:30

How to monitor and disable/enable proxy under Win7 in C#?

Greetings.
It is necessary to monitor whether the proxy is enabled on a PC under Windows 7 or not, as well as turn it off / on. I tried changing the ProxyEnable value in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings, but it did not give the desired result. The checkbox changes its value in the browser properties (control panel), but as such the proxy is not enabled/disabled. Need to apply the changes somehow, how is the question?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Arxont, 2015-09-13
@lysakov

It depends on your needs. If you are writing an application in C# and just want to set the proxy settings that your application will use, then use the System.Net.GlobalProxySelection class ( msdn.microsoft.com/en-us/library/system .net.global... You can also set proxy settings for any particular connection to System.Net.WebProxy ( msdn.microsoft.com/en-us/library/system.net.webpro...
If you really want to , update the proxy settings in the registry, you will need to use P/Invoke to call the WinAPI function WinHttpSetDefaultProxyConfiguration ( msdn.microsoft.com/en-us/library/aa384113.aspx) You can also monitor in the same way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question