How to detect if wireless or wired ethernet

ansalc 436 Reputation points
2020-05-21T22:02:26.483+00:00

In an UWP, how can I detect if my laptop is connected to the internet via Wifi or via wired ethernet?

Thanks.

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Xiaodi Yan 876 Reputation points MVP
    2020-05-21T22:15:48.28+00:00

    You can use ConnectionProfile in Windows.Networking.Connectivity.

    IsWlanConnectionProfile
    Gets a value that indicates if connection profile is a WLAN (WiFi) connection. This determines whether or not WlanConnectionProfileDetails is null.

    IsWwanConnectionProfile
    Gets a value that indicates if connection profile is a WWAN (mobile) connection. This determines whether or not WwanConnectionProfileDetails is null.

    FYI: https://learn.microsoft.com/en-us/uwp/api/windows.networking.connectivity.connectionprofile?view=winrt-18362
    Thanks.


0 additional answers

Sort by: Most helpful