How to skip a network using WebProxy?

If I want to bypass the network as 192.168.1.0/24 using webProxy, is there any way?

WebProxy proxy = new WebProxy();

proxy.ByPassList = ???
+3
source share
2 answers

You can configure it in Internet Explorer and then use

WebProxy Proxy = (WebProxy) WebProxy.GetDefaultProxy (); Outdated.

var iproxy = WebRequest.GetSystemWebProxy();
var url = new Uri("http://www.example.com");
var wp = new WebProxy();
wp.Credentials = iproxy.Credentials;
wp.Address = iproxy.GetProxy(url);

or you can try adding "192.\.168\.1\.*"to proxy.BypassList with something like

List<string> bypasslist = new List<string>(proxy.BypassList);
bypasslist.Add("192.\.168\.1\.*");
proxy.BypassList = bypasslist.ToArray();
+6
source

You cannot change the crawl list after creating the proxy. Use the following constructor overloads:

Uri address = ...
proxy = new WebProxy(address, **true**); 

true " " , 192.168.1.0/24.

:

Uri address = ...
proxy = new WebProxy(address, true, new string[] {"192.168.1.1","intranet",...});
+4

Source: https://habr.com/ru/post/1723883/


All Articles