This sample uses the Network Location Awareness (NLA) API from managed code.
Network Location Awareness
Network Location Awareness