Search code examples
c#windows-servicesvpn

C# Windows Service that connects to network through VPN


I have a Windows Service that must connect, via VPN, to the network in order to send emails. What I need to do (when I start the service) is check whether the VPN connection exists, if not create it, and then connect to the network.

I was looking at DotRAS which looks ideal for doing all the work, however, it doesn't seem to provide a method for creating a new VPN connection.

So my question is, is there a way in which I can programmatically create a VPN connection?


Solution

  • My mistake, turns out DotRAS does have a method for creating new VPN connections :)