PDA

View Full Version : Exception: Could not establish connection to network


ajejebrazorf
22nd January 2009, 08:21 PM
Hi!
I developed a simple application using HttpWebRequest object ( 3-4 code rows
:-) ).
When I run it on emulator(or other devices) it works fine, while when I deploy it to my device
an error occurs: "Could not establish connection to network".
I have the same error when I try executing windows update service on the
device.

My device is connected with activesync and all other installed sw
(skype,messenger,opera..ecc...) on the device can access to internet
network.
I tried also using wifi connection, but the same error occurs.
The appication,also, doesn't try using GPSR connection. Why?

My settings are:
In Settings->connections->select network->I set both dropdown to "My work
Netwok". I tried with myISP,myInternet but the result doesn't change.


Which is the problem??
Help me...
Thanks
Sam.

stephj
23rd January 2009, 01:05 PM
It should work. In Settings->Connection->Connections->Advanced->Select Networks which brings up the Network Management screen, the top one 'connect to the internet should connect using' should be set to the connection used by your network provider for access to GPRS.
If the phone already has an active WiFi connection the program should use that, before trying to start GPRS if it is not already active. I have a UK Qtek 9100 (Wizard). On a hard reset, the OEM Vodafone software automatically sets up a 'Contract Internet' connection and makes it the default, in both Network management and Existing Connections.

ajejebrazorf
23rd January 2009, 06:19 PM
Other applications use correctly wifi connection. Only that one i deploy with visual studio cannot access to internet (activesync,wifi,grps...nothing!!).

I developed the simplest application using HttpWebRequest:
I create new project(vs2008)->smart device project (c#)->CF 3.5->drag button control->on click event i write this:
/**begin**/
HttpWebRequest objRequest =
(HttpWebRequest)WebRequest.Create("http://www.opencellid.org/cell/get?mnc=1&mcc=2&lac=200&cellid=234");
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using (StreamReader reader = new
StreamReader(objResponse.GetResponseStream()))
{
result = reader.ReadToEnd();
}
/**end**/

When I run it on emulator or other devices it works fine, while when I deploy it to my device
an error occurs: "Could not establish connection to network".
I have the same error when I try executing windows update service on the
device.

stephj
27th January 2009, 04:06 PM
The code should work, nothing apparantly wrong with it, but because it is .NET CF 3.5 you may have to use the connection manager method to get it to work. There have been subtle changes from one release of the CF to the next. Some of them drive you nuts, until you have figured out the differences. A similar app I wrote for the Qtek 9100, was written in VS2003 CF 1.1 and works without a hitch, no connection manager required. The gen about the connection manager, and how to use it is at http://msdn.microsoft.com/en-us/library/ms879580.aspx
Good Luck