Reputation: 627
In my app I'm using webservices and if internet connection is true, my app runs very good. Without internet my application generates an error. So how can I check internet connection before my application is connected to services. Because I cannot work with applications tuogn although I did
try {}
catch {}
So, my app is errors in servicesReferent. How do I do if the case does not have an internet connection, or faulty services?
Upvotes: 0
Views: 1928
Reputation: 18805
Be aware that if you connect a WP7 to your development workstation using the USB cable, it will use your workstation's internet connection and this is almost certainly why you always see the network as being available when you are debugging. Disconnecting your workstation from the local network won't help because from the phone's perspective it's still connected to a network (containing two hosts, itself and your workstation) even when that network doesn't have a gateway to anything else.
Upvotes: 4
Reputation: 5651
You can use GetIsNetworkAvailable in the NetworkInterface class from the System.Net.NetworkInformation namespace
for example
bool isNetworkAvaiable = NetworkInterface.GetIsNetworkAvailable()
Upvotes: 4