How to detect if wireless or wired ethernet

ansalc 451 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.

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

Answer accepted by question author
  1. Xiaodi Yan 881 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

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.