Posts

Showing posts from April, 2008

BypassProxyOnLocal - a bug in .Net ?

If you have a local proxy server on your computer (127.0.0.1) that you wish to use when doing FTP communications, all you need do is set BypassProxyOnLocal = false right? There may be many important reasons for using a local proxy, such as caching and security etc. Here's an example: WebProxy proxy = new WebProxy("127.0.0.1", 3128); proxy.BypassProxyOnLocal = true; bool a = proxy.IsBypassed(new Uri("ftp://127.0.0.1:3128")); bool b = proxy.IsBypassed(new Uri("ftp://127.0.0.1:21")); // a=true, b=true (ok) proxy.BypassProxyOnLocal = false; bool c = proxy.IsBypassed(new Uri("ftp://127.0.0.1:3128")); bool d = proxy.IsBypassed(new Uri("ftp://127.0.0.1:21")); // c=true, d=true (???) Why is the proxy being bypassed when I told it not to? The local proxy is always bypassed when when the proxy is on a loopback address. Why? Setting BypassProxyOnLocal to false should NOT bypass the proxy for local addresses. So let's see what MSDN Library ...