How to connect to an existing PBK VPN file

Aug 29, 2014 at 11:05 AM
Edited Aug 29, 2014 at 11:10 AM
Hi, I'm trying to connect to an existing PBK file in a directory,

this is my code:
RasDialer dialer = new RasDialer();
dialer.PhoneBookPath = Application.StartupPath + "\pptp.pbk";
dialer.EntryName = "mersad";
dialer.Credentials = new System.Net.NetworkCredential("test", "test");
dialer.DialAsync();
and the exception is:
An unhandled exception of type 'DotRas.RasException' occurred in DotRas.dll
Additional information: The system could not find the phone book entry for this connection.
Please guide me if you can, Thanks.
Aug 10, 2016 at 9:20 AM
Edited Aug 10, 2016 at 9:29 AM
check if connection exists in phonebook
if (!RasEntry.Exists("mersad", "pptp.pbk"))
{
}