Thursday, October 20, 2005 5:40 PM
Sandeep Prabhakar
How does .NET Compact Framework determine which proxy to use?
This is how .NET Compact Framework determines which proxy to go through while communicating with a server.
The order in which .NET Compact Framework (NETCF) searches for proxy information is:
Step 1: It checks if the programmer has specified this in his program using GlobalProxySelection.Select.
Step 2: If the program does not specify this, .NET Compact Framework uses the System’s webproxy. There are 2 pieces of information retrieved: the proxy’s address and whether Bypass on local address is turned on or not.
The way Step 2 above is performed on Pocket PC and Smartphones differs from how its performed on plain windows CE devices. NETCF tries to obtain the System’s default Web proxy as follows:
For Windows CE devices:
First it tries to get it from Internet Explorer. If IE is not installed it gets it from Pocket Internet Explorer’s registry settings.
There is this property called BypassProxyOnLocal which can be set in Internet Explorer and Pocket Internet Explorer, which bypasses the proxy if the site is considered local.
If (BypassProxyOnLocal == false)
Requests are always sent through the proxy.
If(BypassProxyOnLocal == true)
Requests that are considered non-local and sent through the proxy if the URLs contain a dot “.”. If the URL does not contain a dot, the request is sent directly to the server.
If you are sending data to a server using the IPAddress of the server which contains a dot, the request would be sent through the proxy. To avoid sending the request through proxy, you can do one of the following:
1. Replace the numerical IP address with the machine’s host name and set BypassProxyOnLocal to true.
2. Set GlobalProxySelection.Select to an empty proxy before issuing the request.
For Pocket PC and Smartphones:
NETCF obtains the System’s web proxy by calling into connection manager to request for the proxy information.
This posting is provided "AS IS" with no warranties, and confers no rights.