UWP like default VPN application


I'am developer of VPN application. How can i set my application as default VPN for user profile at Windows,if network is unsecure? Like at IOS "connect on demand". And i need to do this from my C# code.

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

2 answers

Sort by: Most helpful
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,856 Reputation points

    Hello, Welcome to Micorosoft Q&A,

    Your issue that might be related to VPN proxy network and I'm afraid is not suitable to discuss in the Forum. For your scenario, I suggest that you might need to open a support ticket for this. Please contact our paid phone support at MS Support. You will get 1:1 support on that. Select Developer Tools -> Windows UWP Development -> Windows 10 Universal App Dev -> System Services Development-> Networking API in the support page and you could contact the team. Please kindly note that your support ticket will be free if it is Microsoft's issue.

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Peter Smith 581 Reputation points Microsoft Employee

    There's no built-in way to do this automatically. The VPNv2CSP shows you what can be set from a VPN profile. There's a trigger for "trusted" networks, but that's used by enterprise IT admins to decide what's in and out of the corporate network.

    You can turn your profile on and off programmatically. The VpnManagementAgent has methods to ConnectProfileAsync and DisconnectProfileAsync; you can call them yourself as needed. However, this will be difficult to truly automate. There are background triggers, but I've never gotten the "network changed" trigger to work from a background task.

    FYI: you probably already know this, but it's really hard to know if a network is "secure" or not. Many enterprises consider all networks except for their own corporate network to be insecure; other people might only consider "public" networks to be insecure.

    0 comments No comments