Check and Restore VPN Connection

Nov 9, 2009 at 11:51 AM

Hi for all,
I try to check and restore VPN Connection with Windows Service, but I don't have understand the steps.

So, I have a VPN Connection for example "My_VPN", configurated on WinXp and functionally, with "My_username" and "My_password".

How to start the connection, with DotRas?
I've try to use (RasConnection connection in dialer.GetActiveConnections()) but I would call only "My_VPN", and not all connection.

Thank You for Support.

Nov 9, 2009 at 5:59 PM

It would seem you made no attempt whatsoever at looking in the SDK for your answer. There are examples in the help documentation along with code examples in C# and VB.NET in the examples folder. Look at the CreateAndDialVpnEntry solution in the examples folder, it will show you how to use the component for a basic connection.

using System;
using System.Net;

RasDialer dialer = new RasDialer();
dialer.EntryName = "My_VPN";

dialer.Dial(new NetworkCredential("My_username", "My_password"));