Forum Home
Press F1
 
Thread ID: 117452 2011-04-19 11:03:00 VB proxy location bot (15449) Press F1
Post ID Timestamp Content User
1195640 2011-04-19 11:03:00 I am writing an app that easily switches on the proxy. In Windows 7 I am aware that it can detect the network the computer is connected to. Therefore, is there a way I can get my app to detect what it is connected to and apply the right proxy settings?

Thanks,
bot (15449)
1195641 2011-04-19 11:08:00 If the networks were different, you could ping the gateway address. Alex B (15479)
1195642 2011-04-19 11:32:00 I heard of something called proxy.pac...

There are two networks: cas.local and Pineapple City. Whenever the comp connects to cas.local, I want the proxy to be on. When it connects toPineapple city,I want the proxy off.
bot (15449)
1195643 2011-04-19 12:44:00 I have used Proxy Pal for this - turn proxy on and off. I'm think it works with Win 7 and it's free. Well it was when I downloaded it several years ago!! berryb (99)
1195644 2011-04-19 20:55:00 The easiest way is if the administrators of the "cas.local" network were to "push" out the proxy settings to you. They can do it using DNS (search for it - I don't remember exactly how to do it but if you get stuck I can check how we've got things set up at work). That way you could configure your browser/applications to "Automatically detect settings" and it'll just work.

Alternatively, write a proxy.pac file and store it on your computer. If the cas.local and PineappleCity networks use different IP address ranges, you can just use the proxy.pac file similar to:



function FindProxyForURL(url, host)
{
if (isInNet(myIpAddress(), "192.168.1.0", "255.255.255.0"))
return "PROXY 192.168.1.1:8080";
else
return "DIRECT";
}


You set up your browser to use the file by setting the "Automatic Proxy Configuration URL" (or something to that effect) and pointing it at the location of your proxy.pac file
somebody (208)
1