2009-12-07 23 views

回答

2

非常相似question到这个。 Allen Bargi's answer pointing to the jQuery plugin我认为这是检测离线和在线状态的最简单方法,通过触发AJAX调用来确定您的MVC应用程序是否可以访问网络。

您可以考虑的另一件事是研究Google Gears API,它可以让您使用Google Maps离线工作。或者我的理解是,虽然没有亲自尝试过......但:)。

1

这应该让你有

using System.Net.Sockets; 

private void example{ 
Boolean isConnected; 
TcpClient tcpClient = new TcpClient(); 
tcpClient.Connect("maps.google.com", 80); 
isConnected = tcpClient.Connected; 
} 
+0

此代码在哪里坐?除非你将silverlight转储到客户端,否则这是不行的。记住客户端收到html/css,浏览器是运行时。 – 2009-12-08 06:27:31

+0

是啊,哎呀。那天早上,我显然是在一个虚拟的地方。 – AlanPoint45kg 2010-01-13 20:51:46

0

你需要做什么这个奇特?当你处于演示模式时,你能不能在web.config中放置一个键来改变它?

相关问题