views:

1762

answers:

3

Hello everyone,

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

+1  A: 

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)

Brann
Thanks Brann! 1. How to find whether there is default proxy set in my computer? 2. Why "Please note that you cannot set this setting if you're in a partial trust environment (so beware of click-once deployments)"? Any more descriptions?
George2
"so it's usually a good idea to use it " -- use it you mean set to true?
George2
re 1 : IControl Panel/Internet Properties/Connections/LAN settingsre 2 : in a Partial trust environement, you won't be able to override the system-wide default proxy settings
Brann
yes, I mean set to true.
Brann
"won't be able to override the system-wide default proxy settings" -- you mean has no permission or not advised to do so? and Why?
George2
In "IControl Panel/Internet Properties/Connections/LAN settings", there are a couple of settings/checkbox, which one do you mean the default proxy?
George2
@George2 : there's an Advanced button in the 'Proxy Server' groupbox. The default proxy are in the "http" and in the "Secure" box
Brann
@George2 : I think my post is pretty clear : You can't set this setting in a partial trust environment (the .config section will be ignored, and if you try to force it you'll end up with a security exception)
Brann
Thanks Brann, if I do not select the check box -- "Use a proxy server for your LAN (These settings will not apply to dial-up or VPN connections)", does it mean there is not default proxy set?
George2
"You can't set this setting in a partial trust environment" -- you mean I have no permision according to default group security policy?
George2
Please see this question : http://stackoverflow.com/questions/560834/how-can-i-use-the-system-net-section-of-my-app-config-in-a-partial-trust-environm
Brann
@Brann, I want to check whether my computer configures default proxy, and if I do not select the check box -- "Use a proxy server for your LAN (These settings will not apply to dial-up or VPN connections)", does it mean there is not default proxy set?
George2
@George2. Yes. Are you in a corporate environment or at home?
Brann
+1  A: 

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
James L
Thanks TopBanana, two comments, 1. How to find whether there is default proxy set in my computer which .Net application could utilize? 2. Why you said "where there is no default proxy server" then I should "have the default proxy server set to true", seems logically conflicting?
George2
Updated my answer to make it more clear
James L
+1  A: 

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.

Chris S
@chris : do you have in mind a real world scenario in which the user has a default proxy set, and want to use another one for your application?
Brann
To Chris, 1. how could I find which is the default proxy? 2. Any risk of set defaultproxy to false or true?
George2
To Brann, how to find the default proxy set on the current machine?
George2
@George2: you seem to want a proxy to be used even when one has not been configured. Is that the case, and if so, why?
John Saunders
@George2 for specifying none domain username and passwords this is sometimes necessary, I've had to use it before
Chris S
@John, how to know whether my system is configured with a default proxy or not?
George2
@Chris, "specifying none domain username and passwords this is sometimes necessary" -- is your comment related to my question? I did not ask username or password, :-)
George2
Having a dialog I'd say was a pro, on the rare cases where NT authentication isn't used. Although I'm not sure how the .NET web service calls go about getting credentials if it can't find them, it might just use a dialog in which case it makes no difference and my point is void
Chris S