Take a look at https://stackoverflow.com/questions/19236639/get-the-properties-of-the-current-network-connection
How to retrive network category(public or private) programmatically in c#?
Joshi, Aparna
1
Reputation point
in Control Panel -> Network and Sharing Center, there is a network category or type we can see (Public or Private).
is there any C# API available to get that value?
I have attached an image and highlighted the data I am looking for.
Thank you.
3 answers
Sort by: Most helpful
-
-
Castorix31 86,986 Reputation points
2021-11-25T13:49:09.51+00:00 In UWP, you get Network information with
using Windows.Networking.Connectivity;
Something like :
IReadOnlyList<ConnectionProfile> profiles = NetworkInformation.GetConnectionProfiles(); foreach (var profile in profiles) { NetworkAdapter na = profile.NetworkAdapter; NetworkTypes nt = na.NetworkItem.GetNetworkTypes(); NetworkConnectivityLevel ncl = profile.GetNetworkConnectivityLevel(); System.Diagnostics.Debug.WriteLine("Name {0} - Type : {1} - {2}", profile.ProfileName, nt, ncl); }
-
josiah Markus Danbinta 1 Reputation point
2021-11-25T13:52:59.177+00:00 Using the search option will help