.Net default proxy setting

7.8k views Asked by At

If I have a client application which needs to call a web service. I want to know the pros/cons and impact if I set default proxy property to true or false in app.config file? Thanks!

Here is the property I am talking about.

http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx

regards, George

3

There are 3 answers

12
Brann On

This setting can also be setted in the machine-wide .net configuration file (If it's configured in both places, your app.config setting will prevail) Please note that you cannot set this setting if you're in a partial trust environment (so beware of click-once deployments)

That being said, if you set the setting, all http and https calls will use the default internet proxy. This doesn't concern other network connections (tcp for example), even if you've configured a socks server in the Internet Options

If there's no default proxy set, the setting has no impact, so it's usually a good idea to use it (unless you want to explicitly bypass the proxy and make a direct connection)

1
James L On

You may run into situations where there is no default proxy server but you can't connect directly, e.g. in an unattended Windows service running inside a corporate firewall, or when someone hasn't set up internet explorer. For this reason I would have the default behaviour as using the default proxy, but have a property in the config file allowing the user to override this.

The default proxy server is stored in the registry under:

HKEY_LOCAL_MACHINE\ SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\WinHttpSettings
8
Chris S On

I would personally make it a settings/options dialog in the client application so the user can either grab the default, or set their own proxy server with username and password. This way there is no room for error.