如果我想通过Web代理绕过类似于192.168.1.0/24的网络,是否有任何方法?
WebProxy proxy = new WebProxy();
proxy.ByPassList = ???
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",...});
WebProxy proxy = (WebProxy) WebProxy.GetDefaultProxy(); 已弃用。
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);
或者您可以尝试使用类似以下内容将"192.\.168\.1\.*"
添加到proxy.BypassList中:
List<string> bypasslist = new List<string>(proxy.BypassList);
bypasslist.Add("192.\.168\.1\.*");
proxy.BypassList = bypasslist.ToArray();
使用这个
WebProxy lb_proxy = new WebProxy("PROXY_IP", PROXY_PORT)
{
BypassProxyOnLocal = true,
BypassList = new string[] { "192.168.1.1", "192.168.1.2",...}
};
httpRequest.Proxy = lb_proxy;
192\.168\.\d{1,3}\.\d{1,3}
?[a-z]+\.labcrm2015rsg\.com$
?是否有效https://www.nuget.org/api/*
? - PreguntonCojoneroCabrón