0

I created silverlight project.That is dashboard information project. I created two types of dashboard, One is Dashboard.Xaml another one is Dashboard.Html.

Now requirement is If internet connection available means we show Dashboard.Html other wise if internet connection is not available means we show Dashboard.Xaml

How to check Internet connection is connected or not connected in c#?

How to trigger automatically internet is Connected means-Dashboard.Html or not-connected means-Dashboard.Xaml?

Please Help Me...

  • You can read the marked answer [here][1]. It's that you looking for. [1]: http://stackoverflow.com/questions/3159036/check-internet-connection-in-silverlight – Christian Amado Mar 25 '15 at 13:50
  • [how-do-i-check-for-a-network-connection](https://stackoverflow.com/questions/520347/how-do-i-check-for-a-network-connection) – T.Todua Sep 09 '19 at 11:09

2 Answers2

0

Using

bool IsNetIn= NetworkInterface.GetIsNetworkAvailable();
user2526236
  • 1,538
  • 2
  • 15
  • 29
0

You can ping valid address on the internet.

public bool PingHost(string nameOrAddress)
    {
        PingReply reply;
        using (var pinger = new Ping())
        {
            reply = pinger.Send(nameOrAddress);
        }

        bool pingable=false;
        if (reply != null) pingable = reply.Status == IPStatus.Success;


        return pingable;
    }
Cristina Alboni
  • 1,014
  • 9
  • 15