我正在使用一段C#
代码,用于检查我的PC
是否通过VPN 可以访问互联网。
var profile = NetworkInformation.GetInternetConnectionProfile();
if (profile != null)
{
// returning True/False
var IsInternetAvailabele= profile.GetNetworkConnectivityLevel() >= NetworkConnectivityLevel.InternetAccess;
// .......
// .......
//.. Some Other Code..
}
在我的Windows 10
的{{1}}版本上运行良好。收到来自1803
的更新后,我的Microsoft
版本从Windows 10
更新为v1803
。
在v1809
的先前版本上:
Windows 10 v1803
但是在升级var profile = NetworkInformation.GetInternetConnectionProfile();
var value = profile.GetNetworkConnectivityLevel(); // returning "Internet Access"
之后:
Windows 10 v1809
但是我的Internet浏览在var profile = NetworkInformation.GetInternetConnectionProfile();
var value = profile.GetNetworkConnectivityLevel(); // returning "Local Access" (No Internet Access)
上工作正常。我尝试重新启动计算机,重置browsers
,更新Windows10。但是一切都是徒劳的。
是新版本中的network adapter
错误还是其他原因!
注意:此问题仅通过VPN发生。在Windows 10的旧版本中,不存在此问题。