温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:Ajax之实时天气预报源码
当前文件路径:AJAXGetWeather/Core/ValidateOnline.cs

1using System; 2
using System.Collections.Generic; 3
using System.Text; 4
using System.Net; 5
6
namespace Core 7
{ 8
public class ValidateOnline 9
{ 10
public bool IsValidateOnline() 11
{ 12
try 13
{ 14
Uri MyUri = new Uri("Http://www.qq.com"); 15
16
WebRequest wb = WebRequest.Create(MyUri); 17
18
wb.Proxy = new System.Net.WebProxy(); 19
20
WebResponse wsp = wb.GetResponse(); 21
22
return true; 23
} 24
catch (Exception ex) 25
{ 26
return false; 27
} 28
} 29
} 30
} 31





}
}