views:

419

answers:

2

Hi,

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?

+1  A: 

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.

d91-jal
Yeah I read that article, which led me to the DotRas component (see the comments on the article). I never actually thought of using a good old fashioned script! Thanks I will give it a go.
James
A: 

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

James