如何在c#中检查互联网连接 [英] how to check internet connection in c#

查看:79
本文介绍了如何在c#中检查互联网连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了silverlight项目。那就是仪表板信息项目。我创建了两种类型的仪表板,一种是Dashboard.Xaml另一种是Dashboard.Html。



现在要求是如果互联网连接可用意味着我们显示Dashboard.Html其他明智的如果互联网连接不可用意味着我们显示Dashboard.Xaml



如何检查互联网连接是否已连接或未连接c#?



如何自动触发互联网连接意味着-Dashboard.Html或未连接意味着-Dashboard.Xaml?



请帮帮我.. 。

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...

推荐答案

如果您需要Dashboard.Xaml的互联网,请先加载该页面。如果互联网连接不可用,您将收到一个例外情况,根据错误代码和详细信息,您可以加载html页面或显示错误消息。
if you need internet for Dashboard.Xaml, then load that page first. if internet connection not available, you will receive an exception , based on the error code and details you can load html page or display error message.


这篇关于如何在c#中检查互联网连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆