Reputation: 82096
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?
Upvotes: 0
Views: 2976
Reputation: 82096
My mistake, turns out DotRAS does have a method for creating new VPN connections :)
Upvotes: 1
Reputation: 1017
Use a scriptable VPN client, and run it using Process.Start("path-to-your-script")
.
Depending on which client you use, you have different possibilities regarding monitoring the status of the VPN connection.
Here is an article where the Windows rasphone client is used in such a way.
Upvotes: 1