Windows has pretty good VPN management. It's pretty good at redialing the connection when the connection is dropped, and for the most part it works.
However, sometimes it thinks it connected to the VPN when it's really not, and it doesn't validate the connection to a specific internal IP. We needed something that was a bit more robust and could disconnect and reconnect if it couldn't see a specific IP.
This class I wrote takes a VPN connection name and an IP to ping and will use rasphone.exe to connect and NetworkInformation.Ping to verify connectivity. Every 15 seconds, it checks connectivity and redials as needed.
Obviously, the VPN has to have the authentication saved, and redial attempts set to zero.
My article with the code is here.
Update - Changes made
Technorati tags:
VPN,
.NET,
C#,
rasphone.exe