Create a VPN Connection Programmatically
Posted on 2004-11-18
I am trying to develop a call logging program in vb.net. One of the things that I would like it to do would be to create, or open up, a vpn connection to a remote site and then invoke some sort of remote control program. It is the VPN bit that i am having trouble with.
I am aware that I could shell back and call rasdial but as far as I can tell this will only work if there is a preconfigured vpn connection on the machine running the program. This call logging program is intended to work form anywhere (and there will be a web client as well) so there is no way that it can possibly be guaranteed that there will be a properly configured VPN DUN in the network and dialup connections bit of windows. As I see it then I have 3 choices, either
1. Test for the existence of a VPN connection (no prob with rasdial and error levels) and somehow hack into wherever the make new connection wizzard goes and pass the arguments (held somewhere in a database), which would create a VPN on every computer that, used this.
2. Try and feed the details (ip address, username, password, VPN type etc.) into the VPN section of the network and dial up connections bit of windows, if i can ever find it, every time a VPN is required (my favourite solution) My workstation is win2k as far as I can tell there is not much difference between the DUN in W2K and XP but worst case scenario I will just detect the operating system and call a different chunk of code depending on the OS
3. Write a vpn client from scratch (pretty much impossible)