[英]How do I connect to a hidden SSID in Windows 10 programmatically?
I have spent ages on this and I am stuck.我在这上面花了很长时间,但我被困住了。
I am trying to connect to a known hidden SSID programmatically.我正在尝试以编程方式连接到已知的隐藏 SSID。
I am using the following code我正在使用以下代码
await firstAdapter.ScanAsync();
WiFiAvailableNetwork network = firstAdapter.NetworkReport.AvailableNetworks.FirstOrDefault(n => n.Ssid == ssid);
The problem is I need to supply as a first an object of type WiFiAvailableNetwork
but AvailableNetworks
only brings back non-hidden SSIDs.问题是我需要首先提供
WiFiAvailableNetwork
类型的对象,但AvailableNetworks
只带回非隐藏的 SSID。
public IAsyncOperation<WiFiConnectionResult> ConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind, PasswordCredential passwordCredential, String ssid)
https://docs.microsoft.com/en-us/uwp/api/windows.devices.wifi.wifiadapter.connectasync#Windows_Devices_WiFi_WiFiAdapter_ConnectAsync_Windows_Devices_WiFi_WiFiAvailableNetwork_Windows_Devices_WiFi_WiFiReconnectionKind_Windows_Security_Credentials_PasswordCredential_System_String_ https://docs.microsoft.com/en-us/uwp/api/windows.devices.wifi.wifiadapter.connectasync#Windows_Devices_WiFi_WiFiAdapter_ConnectAsync_Windows_Devices_WiFi_WiFiAvailableNetwork_Windows_Devices_WiFi_WiFiReconnectionKind_Windows_Security_Credentials_PasswordCredential_System_String_
The above code works perfectly with non-hidden SSID's.上面的代码与非隐藏的 SSID 完美配合。
Is there an API to connect to a hidden SSID?是否有连接到隐藏 SSID 的 API?
Thanks谢谢
If available, the hidden network should be in the firstAdapter.NetworkReport.AvailableNetworks
list.如果可用,隐藏网络应该在
firstAdapter.NetworkReport.AvailableNetworks
列表中。
As the SSID is hidden, the Ssid
property of WiFiAvailableNetwork
for the target network will be ""
.由于 SSID 是隐藏的,目标网络的
WiFiAvailableNetwork
的Ssid
属性将为""
。
You could make an assumption here and attempt to connect to it using:您可以在此处进行假设并尝试使用以下方法连接到它:
await firstAdapter.ConnectAsync(networks.First(x => x.Ssid == ""), WiFiReconnectionKind.Automatic, "password", "knownSSID");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.