Get SSID of the wireless network I am connected to with C# .Net on Windows Vista

后端 未结 7 821
难免孤独
难免孤独 2020-11-27 04:31

I\'d like to know if there is any .Net class that allows me to know the SSID of the wireless network I\'m connected to. So far I only found the library linked below. Is the

7条回答
  •  生来不讨喜
    2020-11-27 05:29

    (cross-posted in How to get currently connected wifi SSID in c# using WMI or System.Net.NetworkInformation windows 10?)

    I found a rather old library dating back to 2014:

    Microsoft.WindowsAPICodePack-Core version 1.1.0.2
    

    Although it is not conforming to .NET Standard, this library integrates with my .NET Core 3.0 app, but obviously is not cross-platform.

    Sample code:

    var networks = NetworkListManager.GetNetworks(NetworkConnectivityLevels.Connected);            
    foreach (var network in networks) { 
        sConnected = ((network.IsConnected == true) ? " (connected)" : " (disconnected)");
        Console.WriteLine("Network : " + network.Name + " - Category : " + network.Category.ToString() + sConnected);
    }
    

提交回复
热议问题