0

I use the following code to check network availability in my WP7 app.

NetworkInterface.GetIsNetworkAvailable()

But this does not check whether the credentials are entered and network is working fine. Incase of protected networks(still not entered credentials) the condition goes true and my app crashes. Is there any way we can check this condition. How do I solve this?

Shilpa
  • 412
  • 3
  • 14
  • 2
    `and my app crashes` It shouldn't. Even if someone finds the answer to your question, there will still be case when the connection is lost after you make the check. Your code must handle those cases gracefully using try/catch blocks rather than crashing – Kevin Gosse Sep 13 '13 at 05:55

1 Answers1

0

You can find a sample using the NetworkInterface.GetIsNetworkAvailable method on MSDN: http://msdn.microsoft.com/fr-fr/library/system.net.networkinformation.networkinterface.getisnetworkavailable(v=vs.95).aspx

if (NetworkInterface.GetIsNetworkAvailable())



{
 // Online
 }

 else  
 {
 // Offline
}